qwikGit - speeding up common Git actions


1. Why use qwikGit over regular Git commands?

Git is a fantastic but complex tool. By wrapping several actions that form common workflows into a handful of flags, qwikGit increases productivity and decreases the chances of errors while performing basic source control tasks.

The design around qwikGit works best for an individual coder having the following workflow:

  • setting a local git repository and maybe a remote repository
  • maintaining a clean master branch
  • new features development done within a dev branch
  • committing changes in dev branch, merging with master, deleting dev branch and optionally pushing to origin
  • sometimes, rolling back
  • sometimes, deleting the dev branch because the new features are not so awesome, after all
  • cleaning the repository of unwanted additions
  • relying on readable logs to track advances made in a project

Although qwikGit provides many shortcuts, it is not a tool really suited for a team working together on the same codebase.


2. Prerequisites

In order to use qwikGit, you need to have the following software installed on your system:

qwikGit has not been tested on Windows (if you do, let me know) but it works great on Linux and OS X.


3. Installing qwikGit

If the prerequisites are installed, installing qwikGit couldn't be any easier. Just type this in your terminal:

gem install qwikgit

Nothing else. This command will fetch qwikGit on RubyGems.org, install it and make it available anywhere on your system. Fantastic!


4. Using qwikGit

Here are the main commands you'll likely use in qwikGit. If you forget one, just type qgit in your terminal and all the options will be listed (and explained!).

Init

qgit -i (or --init) [--no-c]

Inits a local Git repository, adds all files and commits them with the message 'initial commit'. Prompts you for a remote Git repository. If remote repository selected, it will also push your local repository.

Use the optional --no-c switch to bypass the commit and the prompt for a remote repository.

Commit changes

qgit -c (or --commit) ["message"]

Adds all files and commits them with the optional "message". If no message is given, you'll be prompted for one.

Add a remote repository

qgit -r (or --remote) [name]

Adds a remote repository named after the optional [name]. If no [name] is given, it will be named 'origin'.

You will be prompted for the remote repository URL.

Push to remote repository

qgit -p (or --push) [name]

Pushes the local master branch to the remote [name] repository. If no [name] is given, your local master branch will be pushed to 'origin'.

Get from remote repository

qgit -g (or --get) [name]

The remote [name] repository master branch will be pulled into your local master branch. If no [name] is given, 'origin' will be used.

Create a branch

qgit -b (or --branch) [name]

Creates and moves to a new local branch [name]. If no [name] is given, 'dev' will be used.

Commit changes & push to remote repository

qgit -cp (or --commit-push) [name]

You'll be prompted for a commit message. Then, all files will be added and committed. The local commit will be pushed to [name]. If no [name] is given, 'origin' will be used.

Commit changes & merge branch

qgit -m (or --merge) [name]

All files on branch [name] will be added and committed. You will be prompted for a commit message. Then, branch [name] will be merged into master and then deleted. If no [name] is given, 'dev' will be used.

Commit changes, merge branch & push to remote repository

qgit -cmp (or --commit-merge-push) [branch-name [remote-name]]

All files on branch [branch-name] will be added and committed. You will be prompted for a commit message. Then, branch [branch-name] will be merged into master and deleted. Your master branch on local repository will be pushed to [remote-name].

If no [branch-name] is given, [branch-name] will default to 'dev' and [remote-name] to 'origin'. If a [branch-name] is given but no [remote-name], [remote-name] will default to 'origin'.

Show history

qgit -l (or --log)

Display the commits history in a readable format.

Discard changes in current branch (not master)

qgit --discard [name]

All files in branch [name] will be added and then commited. Your repo will then switch to your master branch and delete the branch [name], without merging the changes. If no [name] is given, 'dev' will be used. Use with caution!

Roll back

qgit --rollback

This gives you three options: deleting all the files created after last commit, rolling back to the previous commit before the current one or removing all the uncommitted changes. You will be asked to choose if you want to force push your changes to your remote repository. Use with caution!

Update qwikGit

qgit --update

Updates qwikGit to its latest version by issuing 'gem update qwikgit'.

Show qwikGit version

qgit -v (or --version)

Display qwikGit current version number.


5. Contributing to qwikGit development

You use qwikGit and you want to contribute? Seriously? Wow... well, fork it, add the features you'd like to see and submit a pull request. It's that easy!


6. License

Copyright (c) 2014 - Nico Schuele. See MIT-LICENSE for further details.

About


Working on many different projects, I always use the same Git workflow. In order to automate some of it, I created a collection of Bash scripts. My collection has grown so I took the time to rewrite them in Ruby and package them as a gem for everybody to use.

Example

With Git:

git add -A .
git commit "some message"
git checkout master
git merge dev
git push origin master
git branch -d dev

With qwikGit:

qgit -cmp

And that's what qwikGit is all about: speeding up common Git actions.

-- Nico Schuele, Jan 2014


comments powered by Disqus