Handy Git Configuration

Spending lots of time in git lately, I thought I’ld log my git environment here since I keep having to replicate it on various machines.

git config --global  rerere.enabled true

git config --global  alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global  push.default current
git config --global  user.name “Randall Hand”
git config --global  user.email “”
git config --global color.ui true
git config --global core.editor vim 
git config --global core.autocrlf input

And on a mac, I have a few more:

git config --global credential.helper osxkeychain
git config --global core.editor ‘subl -w'
git config --global   mergetool.sublime.cmd=subl -w $MERGED
git config --global   mergetool.sublime.trustexitcode=false
git config --global   merge.tool=sublime

Anyone else have any neat things?

Addition Dec-09:

git config --global branch.autosetuprebase always

And for any existing branches that you want to “convert” over to always rebase, execute this in bash:

for branch in $(git for-each-ref --format='%(refname)' -- refs/heads/); do git config branch."${branch#refs/heads/}".rebase true; done

comments powered by Disqus