A good .gitconfig starting point.
This is a .gitconfig
I've been using for some years now and it has proven quite okay. It should be saved in your home directory e.g. /home/johndoe/.gitconfig
. The push directive is set to current
maybe simple
is also a good option for you.
[user]
name = John Doe
email = john.doe@example.com
[color]
branch = auto
diff = auto
interactive = auto
pager = true
status = auto
ui = true
[color "status"]
added = green
changed = yellow
untracked = red
[push]
default = current
[core]
autocrlf = input
pager = less -FRSX
[alias]
ci = commit
co = checkout
st = status -sb
lg = log --graph --pretty=format:'%C(yellow)%h%C(auto)%d%Creset %s %C(white)- %an, %ar%Creset'
Here is a link to the github gist.
Written by Jens Grassel
Related protips
8 Responses
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/86043/7dedb03c52d9b14738f844c799b2dbc4.jpeg)
Here, another great example, https://github.com/gufranco/dotfiles/blob/master/.gitconfig.
With: --rebase options, alias, indentation and space corrections.
Comments are in portuguese.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/52376/2aaae7041aca85da930bcaf14d6768d2.jpeg)
@fernandoperigolo Thanks for the link. There are some nice aliases there. :-)
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/82717/jj1024x1024.jpg)
For shortening your Git commands I would rather use shell aliases: https://coderwall.com/p/i3leza
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/52376/2aaae7041aca85da930bcaf14d6768d2.jpeg)
@jaccus With shell aliases you never know with which commands they may collide if you use (or are forced to use) a lot of different platforms and shells. Therefore I reduced my shell aliases to a bare minimum.
But if you're always on the same kind of plattform/environment I would also go for shell aliases because they're much shorter. :-)
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/96138/048230d83d50ff15f0b4fb4e0c033e5e.jpeg)
@jan0sch
I prefer %C(auto)%d%Creset because the different types of branches (HEAD, local, remote) are displayed in different colors (better readability!)
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/52376/2aaae7041aca85da930bcaf14d6768d2.jpeg)
@pmiossec Great hint! I've updated my gist accordingly. Really great if you happen to have a lot of branches.
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/44646/df1412e1775840374894798d5ed9a7ea.jpeg)
I'll throw mine into the ring.
https://github.com/magnetikonline/dotfiles/blob/master/.gitconfig
I much prefer "git status -sb" for the "git st" alias. Smaller status output FTW! :)
![](https://coderwall-assets-0.s3.amazonaws.com/uploads/user/avatar/52376/2aaae7041aca85da930bcaf14d6768d2.jpeg)
@magnetikonline There was a reason why I didn't use it as default. Although I can't remember it anymore. ;-) I believe it was due to a bug several git versions back.