I note that the default behaviour of git push origin is to “push all branches with same local and distant name”.
If I create a new branch newfeature and check it out, will git push push the branch to origin by default?
Or do I need to use git push origin newfeature even when it’s checked out?
Further, how does the command git push HEAD relate to this?
By default, it will push
newfeatureif and only if a branch callednewfeaturealready exists on the remote.You can change this by using the
push.defaultconfig variable.git push HEADis essentially a shorthand forgit push <name of checked out branch>if you have a branch checked out.