git - make sure push default setting is correct!

in «tip» by Michael Beard
Tags: , , , , , ,

Somewhere along the line, my .gitconfig file changed and set/reset the push default to something other than what it was.

[push]
    default = matching

This is what it should be:

[push]
    default = simple

The value it is set to, determines what git will do with the branches on your machine when you do a push. With matchine, it will push all of the branches in your repo to your remote, if it matches a branch on the remote. Interesting, but not sure why this is the default setting.

We should be using simple, as it will only work with the current branch you're on and if you push it and it doesn't exist in the remote, it will not create it (and it will fail). This is the difference between simple and current (or at least one of them - check out the link below).

Here is a link that explains all of it (rather wordy, but it gets the job done): git push options