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:

[user]
    name = James Bowes
    email = $EMAIL_ADDRESS

[alias]
    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

[apply]
    whitespace = warn

[diff]
    rename = copy
    renamelimit = 600

[pager]
    color = true

[color]
    branch = auto
    diff = auto
    interactive =auto
    status = auto

[push]
    default = upstream

[github]
    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.

3 comments:

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

    ReplyDelete
  2. @Unknown good tip!

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

    ReplyDelete
  3. These two are critical in my gitconfig:

    uncommit = reset --soft HEAD^
    unstage = reset

    ReplyDelete

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