简体   繁体   English

创建新的 git 分支并跟踪或设置新分支的上游

[英]Create new git branch and track or set upstream the new branch

Ie: what's the equivalent of these:即:这些等价于什么:

git checkout -b my_new_local_branch # create a new local branch
git push --set-upstream origin my_new_local_branch # track / set upstream the new local branch to remote repo

but with one command?但是用一个命令?

This is configurable via the push.autoSetupRemote setting.这可以通过push.autoSetupRemote设置进行配置。 The --set-upstream command will be given for you when you push. --set-upstream命令将在您推送时为您提供。 You will still need two commands, because making a branch and pushing it are very different things (and you wouldn't want them to be the same thing).您仍然需要两个命令,因为创建分支和推送它是完全不同的事情(并且您不希望它们是同一件事)。

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

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