“git Push”是否可以作为“git Push origin newfeature”的简写?
我注意到 git push origin 的默认行为是“推送具有相同本地和远程名称的所有分支”。
如果我创建一个新分支 newfeature
并检查它,git push
会默认将该分支推送到 origin
吗?
或者我是否需要使用 git push origin newfeature 即使已签出?
此外,命令 git push HEAD 与此有何关系?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下,当且仅当远程上已存在名为
newfeature
的分支时,它才会推送newfeature
。您可以使用
push.default
配置变量来更改此设置。如果您已签出分支,那么 git push HEAD 本质上是 git push的简写。
By default, it will push
newfeature
if and only if a branch callednewfeature
already exists on the remote.You can change this by using the
push.default
config variable.git push HEAD
is essentially a shorthand forgit push <name of checked out branch>
if you have a branch checked out.