我如何 git push 特定分支?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39689915/
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
How do i git push specific branch?
提问by Vacassal Alsk
I have two branch :
我有两个分支:
:git branch
dev1.1
* master
I have some local changes to the master I want to push. How do I specifically push master branch only?
我对要推送的主服务器进行了一些本地更改。我如何专门推送 master 分支?
回答by Cisplatin
You can use the following:
您可以使用以下内容:
git push <remote_alias> <branch_name>
git push <remote_alias> <branch_name>
So in your case, it would probably be:
所以在你的情况下,它可能是:
git push origin master
git push origin master
回答by Shravan40
If you have already committed your change, then you can push your changes to remote from any branch.
如果您已经提交了更改,那么您可以从任何分支将更改推送到远程。
git push origin branch_name
In your case, branch is master
.
在您的情况下,分支是master
.
回答by Elmer
you could use something like this:
你可以使用这样的东西:
git push [email protected]:bliep/blup.git fork-feature:feature
This will push your local fork-feature
branch to the feature
branch of the [email protected]:bliep/blup.git
repository! I use this to help out colleagues with their PR's sometimes.
这会将您的本地fork-feature
分支推送到存储库的feature
分支[email protected]:bliep/blup.git
!我有时用它来帮助同事处理他们的 PR。
回答by ValyriA
If the history of your branch has changed and it is pointing to a different tip of the head, you'll need to do a force push as follows:
如果您的分支的历史记录发生了变化并且它指向不同的头尖,则您需要按如下方式进行强制推送:
git push origin master - - force