简体   繁体   English

`git push`是否作为`git push origin newfeature'的简写?

[英]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". 我注意到git push origin的默认行为是“推送具有相同本地和远程名称的所有分支”。

If I create a new branch newfeature and check it out, will git push push the branch to origin by default? 如果我创建一个新的分支newfeature并检查出来, git push会默认将分支推送到origin吗?

Or do I need to use git push origin newfeature even when it's checked out? 或者我是否需要使用git push origin newfeature即使它已经签出?

Further, how does the command git push HEAD relate to this? 此外,命令git push HEAD如何与此相关?

By default, it will push newfeature if and only if a branch called newfeature already exists on the remote. 默认情况下,当且仅当遥控器上已存在名为newfeature的分支时,它才会推送newfeature

You can change this by using the push.default config variable. 您可以使用push.default配置变量来更改此设置。

git push HEAD is essentially a shorthand for git push <name of checked out branch> if you have a branch checked out. git push HEAD本质上是git push <name of checked out branch>的简写,如果你有一个分支签出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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