This week's tip of the week is about improving your git settings. Back in December, I shared git's rerere, a git config setting that auto-resolves repeated merge conflicts. If you haven't set that one up yet, go do it.

But rerere isn't the only git config you're probably missing. Here's one of my favourites. You create a new branch, do your work, push, and Git hits you with this:

fatal: The current branch my-branch has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin my-branch

Every. Single. Time. One setting makes that go away forever:

git config --global push.autoSetupRemote true

That's one of five settings I added in my global git config over the last year. The others fix noisy merge commits on pull, stale remote branches piling up, and diffs that are harder to read than they need to be.

That's it! Short and sweet. Until the next one!

Keep Reading