git push 没有合并的分支
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13529948/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git push branch without merge
提问by nikmin
I have one branch master on the server (remote). I created new local branch that doesn't exist on the remote (server). How can I add (push) the branch to the remote (server) without merging it with the master branch
我在服务器上有一个分支主机(远程)。我创建了远程(服务器)上不存在的新本地分支。如何将分支添加(推送)到远程(服务器)而不将其与主分支合并
采纳答案by samuil
git push remote local_branch_name:remote_branch_name
Usually your remote will be origin, and both local and remote branch will be the same (although you can push local branch as a remote with different name). If their names are identical you don't have to provide colon-separated names -- one will be sufficient.
通常你的远程将是原点,并且本地和远程分支将是相同的(尽管你可以将本地分支作为具有不同名称的远程推送)。如果它们的名称相同,则您不必提供以冒号分隔的名称——一个就足够了。
What you are trying to achieve has nothing to do with merging branches. I'd suggest further reading about branches and remotes (git-scm bookis pretty good resource).
您要实现的目标与合并分支无关。我建议进一步阅读有关分支和遥控器的内容(git-scm 书是很好的资源)。
回答by Faruk Sahin
You can use the following command:
您可以使用以下命令:
git push -u origin newBranch
-u
will set up your local branch to track the remote branch.
-u
将设置您的本地分支以跟踪远程分支。
回答by mamapitufo
You just push your local branch:
您只需推送本地分支:
$ git push origin <your-branch>
You can use the -u
flag to set your local brach to track the remote too.
您也可以使用该-u
标志来设置本地分支以跟踪远程。