Best Git tools & configuration tips

Git is very flexible and powerfull tool. At the first try it can be overwhelming especialy for people comming from SVN. Here i will describe some tools and configuration that i use and are very helpful with day-to-day tasks.

Step 1. Enable Bash completion:

First thing after installing Git is enabling completion:

cp /opt/local/etc/bash_completion.d/git ~/.git-bash-completion.sh
echo "[ -f ~/.git-bash-completion.sh ] && . ~/.git-bash-completion.sh" >> ~/.bash_profile
. ~/.bash_profile

Better completion together with branch names can be achieved trought:

https://github.com/git/git/blob/master/contrib/completion/git-completion.bash

Step 2. Configure your git

There is two way to edit your git configuration. You can use command:

git config --global color.ui "auto"

or manually edit you .gitconfig file stored by default in home directory.
Here is my gitconfig with some helpful aliases:


Step 3. Command prompt modification

Nice feature if you are using git from terminal is to enable git tips in command prompt.

The one that has the most features is:
https://github.com/lvv/git-prompt

If its too ‘noisy’ for you checkout some custom command prompt modifications from git-hub like this:

https://gist.github.com/790086

Step 4. Install some plugins

To get plugin working put it anywhere on your $PATH (~/bin is recommended). Then git will see it and you’ll be able to run `git plugin_name`.

  • git WTF http://git-wt-commit.rubyforge.org

    Plugin with self explonatory name. Very helpful when you are not sure what is the state of you repos.
    One command replaces a lot of typing.

  • git-divergence https://github.com/garybernhardt/dotfiles/blob/master/bin/git-divergence
    Showing incoming and outgoing changes.

  • git-flow https://github.com/nvie/gitflow
    Plugin for managing very popular branching model git-flow.

    And plugin for completion:
    https://github.com/bobthecow/git-flow-completion

  • git-extras https://github.com/visionmedia/git-extras

    Bunch of various command for repo statistics and day-to-day work.

    Step 5. Working with github?

    https://github.com/defunkt/hub

    Step 6. Have fun using Git

    Collect achievements as you learn using Git 🙂

    https://github.com/icefox/git-achievements