git push 到现有的远程分支
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12486653/
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 to existing remote branch
提问by sandeeps
How do I push changes from a local git branch to an existing non-master remote branch? If I do a "git push", it tries to push changes in all local branches to the remotes they are tracking.
如何将更改从本地 git 分支推送到现有的非主远程分支?如果我执行“git push”,它会尝试将所有本地分支中的更改推送到他们正在跟踪的遥控器。
回答by Greg Hewgill
To do this you use a refspec
, as explained in the git push
documentation. For example:
为此,您可以使用refspec
,如git push
文档中所述。例如:
git push origin local_branch_name:remote_branch_name
回答by Kevin Bedell
If the branch already exists in the repository, it should just be:
如果该分支已存在于存储库中,则它应该是:
git push origin branch_name
git push origin branch_name