Friday, December 2, 2011

My .gitconfig - 2011 Edition

It's been just shy of five years since I first blogged about my .gitconfig file, so I figured now would be a good time to revisit it. If you're not already aware, you can set git configuration values in a .gitconfig file in your home directory, and have them apply to all git repositories you work on. This is particularly useful for aliases and to set your email address.

My current .gitconfig:

    name = James Bowes
    email = $EMAIL_ADDRESS

    ci = commit -a
    co = checkout
    st = status
    praise = blame
    br = branch
    diffstat = diff --stat
    cat = !cat @
    ds = diff --stat
    lol = log --graph --decorate --pretty=oneline --abbrev-commit
    lola = log --graph --decorate --pretty=oneline --abbrev-commit --all

    whitespace = warn

    rename = copy
    renamelimit = 600

    color = true

    branch = auto
    diff = auto
    interactive =auto
    status = auto

    default = upstream

    user = jbowes
    token = $GITHUB_TOKEN

I cribbed lol and lola from Adrian. Naturally, there's now a github section. I get the most use out of diff.renamelimit, which helps me when I'm doing merges in large projects like Candlepin, and the ds alias, which gives me a good overview of how much work I've done prior to a commit.


  1. I recommend you:
    default = tracking
    When you are in tracking branch and do "git push" it does "git push origin tracking_local:tracking_remote"

  2. @Unknown good tip!

    I've updated my post with that, but using the new syntax, default = upstream

  3. These two are critical in my gitconfig:

    uncommit = reset --soft HEAD^
    unstage = reset


© 2012 James Bowes. Icons by glyphicons. Powered by Blogger.