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 ~/
echo "[ -f ~/ ] && . ~/" >> ~/.bash_profile
. ~/.bash_profile

Better completion together with branch names can be achieved trought:

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:

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

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

    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
    Showing incoming and outgoing changes.

  • git-flow
    Plugin for managing very popular branching model git-flow.

    And plugin for completion:

  • git-extras

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

    Step 5. Working with github?

    Step 6. Have fun using Git

    Collect achievements as you learn using Git 🙂