My .gitconfig file

I recently updated to Mountain Lion and had to install a few more things to get Git to work properly.

I also realized that Git GUI stopped working. A quick addition to my .gitconfig file did the trick, but I thought I’d take the opportunity to share my .gitconfig file with you; it could be useful to someone, and I will be able to come back to that post next time I change my computer :)

     email = my_email_address
     name = Jeremy Herve
     signingkey = my_signing_key
     user = jeherve
     token = my_token
     branch = true
     ui = true
     diff = true
     status = true
     s = status
     ci = commit
     co = checkout
     cp = cherry-pick
     ls = branch -a
     oops = reset --soft HEAD~1
     rh = reset --hard
     save = stash save
     rh = reset --hard
     pop = stash pop --index
     restash = !git stash pop --index && git stash save
     rs = !git stash pop --index && git stash save
     files = diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT
     lola = log --oneline --decorate --graph -n 15 --all
     ll = log --stat --abbrev-commit
     one = log --pretty=tformat:"%H" -1
     pushf = ! [[ $(git symbolic-ref --short HEAD) != \"master\" ]] && git push --force-with-lease
     autocorrect = 1
     editor = nano
     default = simple
     gpgsign = true
 [color "status"]
     added = green
     changed = yellow
     untracked = red
     modified = yellow
     rebase = false

That’s it. If you have any recommendations or remarks, let me know! I am always looking for more tips!

6 replies on “My .gitconfig file”

axtaxt says:

I like ‘oops’, I will cherry-pick it. Here is mine: (credit goes to @tibor and @akos, don’t know anymore which line belongs to who):

lol = log --oneline --decorate --graph -n 15
lola = log --oneline --decorate --graph -n 15 --all
co = checkout
rh = reset --hard
save = stash save
pop = stash pop --index
restash = !git stash pop  --index && git stash save
rs = !git stash pop  --index && git stash save
s = status
files = diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT
fixup = !sh -c 'git commit -m "fixup! $(git log -1 --format='\''%s'\'' $@)"' -
squash = !sh -c 'git commit -m "squash! $(git log -1 --format='\''%s'\'' $@)"' -
ri = rebase --interactive --autosquash
f = fetch --all --tags --prune
hist = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
rev = log -1 --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
Jeremy says:

That’s a nice follow up! I don’t really use git log (I use gitk for that kind of things), but your some of your aliases make git log a bit more interesting, thanks!

kondenzator says:

I like lola… :)

Some missing:

autosetuprebase = always ## strongly recommended
logallrefupdates = true
myinit = "!git init && git commit -m "Initial, empty commit" --allow-empty && git branch root"
conflictstyle = diff3
Jeremy says:

I love myinit. It’s simple, but such a time saver. I have added it to my file, thanks!

Koke says:

Not exactly a .gitconfig tip, and I haven’t used git gui much, but is what I use

Jeremy says:

I don’t really use Git GUI either, only when I have been lazy and neglected to commit changes for a while. It then becomes a bit too messy to handle via command line :)

I will give GitX a try then, it seems cool! Thanks!