If you download the git tarball, you'll find a
git-completion.bash script that adds shell completion to your git day-to-day usage. Look for it in the
contrib/completion/ directory. (update: if you can't find it there, look for it in the
$sharedir/git-completion/ directory. A recent patch by Johannes Schindelin promoted git-completion.bash to the big leagues.)
When I started using git, I just sticked the script into my
~/.bash_completion.d/ and bash picked it up after a
exec bash -login.
One thing I didn't do was read the file, and I missed some cool stuff. One of them is a
PS1 hack to show the branch you are on:
4) Consider changing your PS1 to also show the current branch: PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ '
The argument to __git_ps1 will be displayed only if you are currently in a git repository. The %s token will be the name of the current branch.
Be careful to use '' and not "" in the PS1= statement.
If you have several branches active at the same time, this really helps.