Git ships with conservative defaults that made sense in 2005 and mostly survive on inertia. Five one-line changes make day-to-day mistakes structurally harder. Each takes ten seconds; none changes anything you have already committed.
1. pull.ff=only - pulls that cannot create surprise merges#
git config --global pull.ff only
A plain git pull on a diverged branch creates a merge commit you did not ask for. With this setting, a pull either fast-forwards cleanly or stops and tells you to decide - rebase or merge - consciously. It converts a common accident into a deliberate choice.
2. fetch.prune=true - remotes that tidy themselves#
git config --global fetch.prune true
Deleted remote branches normally haunt your git branch -a forever. Prune makes every fetch drop the local copies of branches that no longer exist on the remote, so the list you see is the list that is real.
3. rerere.enabled=true - resolve each conflict once#
git config --global rerere.enabled true
Reuse recorded resolution: Git remembers how you resolved a conflict and replays it the next time the same conflict appears - a gift for anyone who rebases long branches or keeps a fork in sync. Our rerere guide shows the workflow in full.
4. push.autoSetupRemote=true - no more —set-upstream#
git config --global push.autoSetupRemote true
Pushing a new branch stops failing with the “no upstream” lecture and just sets the upstream. Modern Git (2.37+) has this built in; it removes the most copy-pasted error message in the tool.
5. init.defaultBranch=main - the name you expect#
git config --global init.defaultBranch main
New local repositories start on main, matching every modern host, instead of falling back to the legacy default and forcing a rename later.
One caveat: these are personal settings, not team policy. Anything the team must share belongs in documentation, hooks, or CI - a config value only travels as far as your laptop. For the shared layer, git hooks for Laravel projects is the right tool.
Set all five now; your future self, mid-conflict, will be quietly grateful.
Share this post
Keep reading
Annotating Commits with git notes: Metadata Without Rewriting History
Some things belong on a commit but not in it: review links, benchmark results, the ticket nobody remembered to reference. git notes adds them after the fact, no rebase required.
Backing Up Your Git Server So It Actually Restores
Every clone is a partial backup - but hooks, config and server state live outside the repo. Mirror, bundle, copy off-site, and rehearse the restore.
Cherry-Picking: One Commit Without the Branch
Cherry-pick copies a single commit onto your branch and leaves the rest behind. Right for hotfixes across release branches, wrong as a sync strategy.