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.
The idea here, is to merge "one of your local branch" (here anotherLocalBranch ) to a remote branch ( origin/aBranch ). For that, you create first " myBranch " as representing that remote branch: that is the git checkout -b myBranch origin/aBranch part. And then you can merge anotherLocalBranch to it (to myBranch ).
First we run git checkout master to change the active branch back to the master branch. Then we run the command git merge new-branch to merge the new feature into the master branch. Note: git merge merges the specified branch into the currently active branch. So we need to be on the branch that we are merging into.
To do a merge (locally), git checkout the branch you want to merge INTO. Then type git merge <branch> where <branch> is the branch you want to merge FROM. Because the history of master and the history of make_function share common ancestors and don't have any divergence descendents, we get a "fast-forward" merge.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With