I do have a local branch with some changes, and I want to merge it to remote master. When I run: git merge master
I get:
Already up-to-date
but I still can see that the master doesn't contain the new changes.
I checked the following issue Git merge reports “Already up-to-date” though there is a difference Ask, but it seems in one hand to be outdated, and on the other hand, none of the hints there were helpful.
Any idea or hint?
In GitHub Desktop, click Current Branch. Click Choose a branch to merge into BRANCH. Click the branch you want to merge into the current branch, then click Merge BRANCH into BRANCH. Note: If there are merge conflicts, GitHub Desktop will warn you above the Merge BRANCH into BRANCH button.
To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch. This example merges the jeff/feature1 branch into the main branch.
Then, you could run git mgd branch-name to merge and delete a branch in one go. Note that the lowercase -d flag ensures that the branch will only be deleted if it has already been fully merged; thus, you don't have to worry about the first command not working correctly and then losing the branch.
If you want to merge your branch to master on remote, follow the below steps:
git push origin br-1
.git checkout master
.git pull origin master
.git merge br-1
. This may give you conflicts which need to be resolved and changes committed before moving further.git push origin master
.To merge branch with master,there are two ways you can proceed
Here also you can go with two different commands,first is
git checkout master
git pull --rebase origin branch_name
. It may give you some conflicts which you can
resolve by using git status
,after resolving you can check if any
conflict is more there or not by using git rebase --continue
.git cherry-pick <commit id>
.If you are getting conflict use
git cherry-pick --continue
.Actually this is the more suggested way you can proceed.
This is most easiest way to merge. Create new pull request, select the branch you want to merge and resolve the conflicts.
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