happy-git-with-r icon indicating copy to clipboard operation
happy-git-with-r copied to clipboard

git config worth considering

Open jennybc opened this issue 6 years ago • 1 comments

One general goal is to make it very unlikely that a novice finds self unexpectedly "in the middle of" a merge. Obviously there's no way to universally avoid reconciling conflicts, but it's much nicer to be alerted to the problem and given the chance to decide how to proceed.

Default to allowing only fast forward merges upon pull.

git config --add pull.ff only

It's possible that doing same for merges (merge.ff) is a good idea too?


Re: doing something sensible when you just do git push, with no branch specified.

Push the current branch to a branch of the same name. And that's it. Don't push other branches.

git config --global push.default current

More notes ...

Git 2.0 (release 2014-05) uses simple push strategy by default:

  • branches are pushed to their upstream branch
  • no push if remote branch name != local branch name, unless explicitly specified via git push origin remotebranchename

Git versions below 2.0 use matching strategy by default:

  • git push, no arguments, pushes ALL branches that have same name locally and on remote

Conclusion: simple is better than matching.

Re: current vs simple, apparently this has to do with upstream tracking branches and branch names, which is yet another issue. If you always name local branch and remote branch the same, you will never notice the difference. I guess technically simple is safer.

jennybc avatar Oct 02 '18 07:10 jennybc

core.autocrlf on Windows: you almost certainly want this to be true.

jennybc avatar Jan 21 '19 21:01 jennybc