How Core Git Developers Configure Git
40 comments
·February 25, 2025_kb
schacon
I really wanted to add this (I linked it in the last paragraph) but I really wanted to keep the recommendations globally applicable in vanilla git. Delta is awesome though.
conaclos
Some extra options I like:
[apply]
# Remove trailing whitespaces
whitespace = fix
[color "diff"]
whitespace = red reverse
[diff]
colorMovedWS = allow-indentation-change
[format]
pretty = fuller
[log]
date = iso
[pull]
ff = only
schacon
I did almost put `log.date iso` in there, I like that one too.
chungy
My own ~/.gitconfig looks like this:
[alias]
co = checkout
ci = commit
st = status
br = branch
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short
type = cat-file -t
dump = cat-file -p
dft = difftool
[tag]
sort = version:refname
[tar "tar.xz"]
command = xz -c
[tar "tar.zst"]
command = zstd -T0 -c
[log]
date = iso-local
[pull]
ff = only
[diff]
tool = difftastic
[safe]
directory = *
[advice]
detachedHead = false
[init]
defaultBranch = master
chungy
Shortened aliases come from cvs/svn land, sorting tags by a logical manner, adding some extra archive types for "git archive", making it so git log always shows my local time zone, pull will never do a non-ff merge, make it so Git doesn't complain about repositories in places it doesn't like, turning off an annoying message about a detached HEAD state, and shut git up about the default branch.
schacon
Yeah, I didn't do aliases on purpose, because I wanted everything to be fairly global, where I feel like aliases are more personal. But yes, aliases are great.
qbonnard
Related: Popular Git config options by Julia Evans [0]
idoubtit
That was a useful read. I'd been frustrated by `merge.conflictstyle = diff3` so I'm glad I learned about `zdiff3`.
I also discovered `fetch.prune` and `pull.autoSetupRemote` which will slightly enhance my workflow.
My only disagreement is with the diff prefixes. I prefer to display one path starting with ".", so that I can double-click it and paste it. So I don't want contextual prefixes, I'll keep my `diff.dstPrefix = ./`.
neals
How much of this is for a noob like me that just uses vscode? I hardly ever see the git command line, and when I do see it, its trouble beyond what anybody can fix...
jbverschoor
Nothing wrong with a gui. Esp with git imo. The process doesn’t require blazing fast agility, but careful review and selection.
Graphical diff viewers are way better anyway.
schacon
Of course, you can also try GitButler (https://gitbutler.com), it's a pretty nice GUI :)
jeffwass
Of course, there's an xkcd for that : https://xkcd.com/1597/
eastbound
Should create an XKCD with “There is always n+1 Git client GUI”.
EVERY new employee arrives saying “Hey I’ve found this great UI for git, this one really nails it and makes git easy” and every time it’s a new Git UI that I’ve never heard of. It’s the “hello world” of startups: Creat their great git UI and publish it.
Then they commit with the default crappy commit messages and they don’t know how to git-rebase-i.
leslielurker
Wow I had no idea these were available. I really hope some of these become the default config.
carlosneves
Greatly appreciate these tips! I'll apply most of them, especially the diff ones.
uscneps
i know that my comment is not related to the post, but i just want say that the image is really cool! who is the designer/artist?
schacon
GitButler's amazing designer is Pavel: https://bsky.app/profile/pavellaptev.bsky.social
uscneps
thanks!
nialv7
when's git-fsmonitor going to support linux?
tobyhinloopen
I immediately applied most of these, thanks!
FirmwareBurner
What about the famous "disable garbage collection"?
While everyone is here considering their life choices (at least as far as they relate to ~/.gitconfig), highly recommend delta [1] as a companion to the git cli.
[1]: https://dandavison.github.io/delta/