简体   繁体   中英

Does `git push` work as shorthand for `git push origin newfeature`?

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 newfeature if and only if a branch called newfeature already exists on the remote.

You can change this by using the push.default config variable.

git push HEAD is essentially a shorthand for git push <name of checked out branch> if you have a branch checked out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM