Git Toolbox

// Git Toolbox

Git config generator

Tick what you want, get a ~/.gitconfig ready to paste. Recommended settings are already on.

Identity

Use the email of your GitHub / GitLab account, or the noreply address they give you to keep yours private.

Everyday

  • Name of the first branch of every new repository.

  • Editor opened for commit messages and interactive rebases.

  • git pull replays your commits on top instead of creating “Merge branch 'main'…” commits.

  • The first git push of a new branch works without --set-upstream.

  • Forget remote branches that were deleted on the server.

  • Pull and rebase even with uncommitted changes: Git puts them aside and back.

  • git rebase -i places your fixup! commits next to the commit they fix.

  • Stacked branches follow when you rebase the one below.

Safety nets

  • Conflicts also show the original version: much easier to resolve.

  • Git remembers how you resolved a conflict and does it again next time.

  • git stauts → asks whether you meant git status.

  • Shows the diff in the editor while you write the commit message.

  • git push only pushes the current branch, never all of them.

Readability

  • Clearer diffs, especially when code moves around.

  • Moved lines get their own colour instead of − and +.

  • git branch lists the branches you worked on recently first.

  • v1.10 comes after v1.9, not before.

  • Long lists (branches, tags) in columns.

Your system

  • Line endings: avoids diffs where every line changed for nothing. Better: a .gitattributes in the repo.

  • Stores your HTTPS credentials so Git stops asking.

  • Windows: allows paths longer than 260 characters (deep node_modules…).

Result

No name: your commits will show your computer's user name.

No email: GitHub won't link your commits to your account.

Run git config --global --edit and paste this at the end of the file.

~/.gitconfig
[init]
defaultBranch = main
[pull]
rebase = true
[push]
autoSetupRemote = true
default = simple
[fetch]
prune = true
[rebase]
autoStash = true
autoSquash = true
[merge]
conflictStyle = zdiff3
[rerere]
enabled = true
[help]
autocorrect = prompt
[diff]
algorithm = histogram
colorMoved = zebra
[branch]
sort = -committerdate
[tag]
sort = version:refname