Recommended: git-completion.bash

Posted by andy.grover on Oracle Blogs See other posts from Oracle Blogs or by andy.grover
Published on Fri, 07 May 2010 11:20:46 -0800 Indexed on 2010/05/07 19:49 UTC
Read the original article Hit count: 340

Filed under:

If you use git on a daily basis like I do, git-completion.bash is a great way to make your life a little easier. While I guess it does add tab-completion for git commands, the most useful feature for me is the ability to put the current branch into the cmdline prompt. Now that I am comfortable working with multiple git branches and remotes, a little reminder where I am prevents time-consuming mistakes. git-completion.bash lives in git's git tree.

  1. git clone git://git.kernel.org/pub/scm/git/git.git
  2. copy git/contrib/completion/git-completion.bash to ~/.git-completion.sh
  3. Follow the instructions in the file to set up, and enable showing branch in $PS1
I also use this alias in my ~/.gitconfig, which is convenient:
[alias]
        log1 = log --pretty=oneline --abbrev-commit

Have fun!

© Oracle Blogs or respective owner