So today I made the switch to use GIT over SVN for all of my personal projects because we’ve been using it at IPC Media for months. One of the most useful things I’ve found is the ability to set up aliases for command commands, because let’s face it all developers want is to do the same job with less key presses.
There are 2 ways to add aliases, with a cli command or by editing the .gitconfig file in your home directory. The command looks like:
git config --global alias.foobar command
Which will write the following to your ~/.gitconfig
[alias] foobar = command
Obviously there is no git tool called command, but you get the idea. The aliases that I use are as follows (I’ve copy n pasted this from my .gitconfig file)
[alias] rb = rebase ci = commit co = checkout st = status lg = log --color --graph --name-only
You may say that some of these look familiar and you’d be right, that’s because they are the same short hand as those found by default in subversion. Since that is the source control I’ve used the most to date, it made sense in my head to transition with these.
The last one of those commands is also my favourite. This will show the git log with a pretty useful branch graph. The command is based on the information I found on Stack Overflow and helps to visualise the branching & commit information within the current checkout.