Dec
18
2007

Various Tips For Setting Up Git: Improve Gitk Look And Get Bash Completion

You just installed git. Now it’s time to set it up. First, you want to set up your name and email, which will be added to your commits:

$ git config --global user.name "Your Name"
$ git config --global user.email name@email.com

Another useful option is alias. We can also use the command line to set it or we can edit ~/.gitconfig:

[alias]
	st = status

This means we can just type git st instead of git status. As you get more familiar with git, you’ll want to add your own aliases.

Check the manual for the complete list of options.

Change gitk fonts

Gitk looks bad. Really bad. We can improve it by changing the default font. You need to edit ~/.gitk:

set mainfont {Monaco 10}
set textfont {Monaco 10}
set uifont {Monaco 10}

Much better.

Bash completion

Lookup contrib/completion in the git source directory. Git-completion.bash includes the instruction to set it up. You need to copy that file somewhere and source it in your ~/.profile. Once this is done, you can press tab to complete git commands, options and the name of branches in bash. The script also adds __git_ps1 which you can use in your PS1 to include the name of the current branch in your bash prompt. Because you will use branches with git, it can help you remember that you switched branch just before leaving work the day before.

Written by jfcouture in: git |

6 Comments »

  • Alok

    The fonts *are* really nice. Thanks for the tip.

    Comment | January 7, 2008
  • [...] of freebies, so please encourage them; they make awesome videos. (really!) You also want to read this article on J-F’s blog. It’ll show you how to put the branch name in your shell prompt. (that alone was worth coming [...]

    Pingback | January 16, 2008
  • Great presentation, Jean-François. It’s almost 2 AM, and I’m still playing with Git. There’s an alternative to gitk: qgit, which I talk about on my blog: “An alternative to gitk: qgit”:http://blog.teksol.info/2008/1/16/an-alternative-to-gitk-qgit

    Comment | January 16, 2008
  • I like how you assume everybody’s on OS X (Monaco font). Just the way it should be! lol!

    Comment | January 17, 2008
  • [...] [2] See how to configure your console in the same manner and also get auto-completion for Git here. [...]

    Pingback | June 7, 2008
  • jenna jamersons pussy…

    Yeah, I see the case. Id feel very troubled in such a situation….

    Trackback | February 20, 2009

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes