Jamie Bennett Speaks

Thoughts from Jamie Bennett

Learning git – the version control Swiss army knife

Written by Jamie Bennett on October 1st, 2008 at 8:48 pm in Uncategorized

git is my revision control system of choice. It is immensely powerful and fast but it does have a downside, it’s pretty hard for new users to learn.

Recently I was asked, “what’s the best way to learn git”. I thought a little while, scratched my head some, and said I’d get back to them.

Anyway, I thought the solution I came up with could benefit others so here it is.

There is a wealth of documentation on the Internet, what git is, some beginner tutorials, even lists of useful tips so what is the best way to learn git? Well here is what I think you should do.

Must Reads

  • Go read Git Magic by Ben Lynn, an excellent ‘book like’ introduction to git. Its 37 pages long (PDF version) so its no quick read but for me, its absolutely essential.
  • For its explanation of the 20 most common git commands you will possibly use on a day to day basis, this document gets put on my ‘must read’ list.
  • Print this cheat sheetout and keep it by you keyboard always.
  • For more advanced tips, checkout this wiki page
  • and finally, if your not sick of reading by now, there are lots more links on the git documentation page.

    Of course, none of the above information is useful unless you actually use the tool so fire up your terminal and play around.

    ~/.gitconfig

    One other thing that may be useful is my ~/.gitconfig file. I’ve simplified it somewhat but the useful parts are below.

    ~/.gitconfig is the configuration file for git where you can customize git to your hearts content. For a list of available options have a look at the man page for gitconfig or view it online here.


    [user]
    name = Jamie Bennett
    email = jamie@linuxuk.org
    [alias]
    ci = commit -a
    co = checkout
    st = status -a
    di = diff
    br = branch
    cl = clone
    me = merge
    pa = log -p
    [apply]
    whitespace = strip
    [diff]
    color = auto
    rename = copy
    [pager]
    color = true
    [status]
    color = auto

    Hope that helps.

    Leave a Reply