Merge local branch into remote branch other than master?

后端 未结 1 1630
不思量自难忘°
不思量自难忘° 2021-02-13 18:07

so I have a local branch A that doesn\'t exist yet in remote repo. And I have remote branch B in remote repo. How do I merge my local changes into the remote branch?

re

1条回答
  •  迷失自我
    2021-02-13 18:57

    If branch B is at local, You can merge A to B locally and push B to remote:

    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.

    or, fetch B branch to local and merge A to B , then push B to remote, like this:

    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)
    

    0 讨论(0)
提交回复
热议问题