I just encountered a problem when merging a branch into master in git. First, I got the branch name by running git ls-remote
. Let's call that branch "branch-name". I then ran git merge branch-name
command and got the following result:
fatal: branch-name - not something we can merge
How do I resolve this error?
This error suggest that the branch from where you want to merge changes (i.e. in you case branch-name) is not present in you local, so you should checkout the branch and fetch the local changes. Checkout to your master branch and fetch, then follow the below steps:
I suggest checking if you are able to switch to the branch that you are trying to merge with.
I got this error even though the branch I wanted to merge with was in local repository and there were no spelling errors.
I ignored my local changes so that I could switch to the branch (Stash or commit can also be preferred). After this I switched back to the initial branch, and the merge was successful.
You are getting this error because the branch you want to merge doesn't exist on your local repository.
So, first checkout the brach you want to merge into master branch by the following command:
After this try to merge it with master branch by the following command:
I got this error when I did a
git merge BRANCH_NAME "some commit message"
- I'd forgotten to add the -m flag for the commit message, so it thought that the branch name included the comment.