简体   繁体   English

将本地分支合并到主站以外的远程分支?

[英]Merge local branch into remote branch other than master?

so I have a local branch A that doesn't exist yet in remote repo. 所以我有一个在远程仓库中尚不存在的本地分支A. And I have remote branch B in remote repo. 我在远程仓库中有远程分支B. How do I merge my local changes into the remote branch? 如何将本地更改合并到远程分支?

refer me to some links if you can. 如果可以的话,请参考一些链接。

If branch B is at local, You can merge A to B locally and push B to remote: 如果分支B在本地,您可以在本地合并A到B并将B推送到远程:

git checkout B
git merge A
git push origin B

If you don't have B at local, you can push A to remote and pull request to merge A to B and click merge button on github. 如果本地没有B,可以将A推送到远程并拉出请求以将A合并到B并单击github上的merge按钮。

or, fetch B branch to local and merge A to B , then push B to remote, like this: 或者,将B分支获取到本地并将A合并到B,然后将B推送到远程,如下所示:

git checkout master
git fetch orign B:B       (fetch B to local)
git checkout B            (checkout to branch B)
git merge A               (merge A to B)
git push origin B         (push merged branch B to remote)

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

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