Merge local branch into remote branch other than m

2020-06-14 04:26发布

问题:

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?

refer me to some links if you can.

回答1:

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)


标签: git github