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?
It's a silly suggestion, but make sure there is no typo in the branch name!
For me the problem occured when I tried this:
So actually I should have written
master
instead ofdevelop
,because master was the branch name of Subtree,not my actual branch.When pulling from a remote upstream,
git fetch --all
did the trick for me:In other cases, I found the "Not something we can merge" error will also happen if the remote (origin, upstream) branch does not exist. This might seem obvious, but you might find yourself doing
git merge origin/develop
on a repo that only hasmaster
.I had this issue as well. The branch looked like 'username/master' which seemed to confuse git as it looked like a remote address I defined. For me using this
worked perfectly fine.
We got this error because we had a comma (,) in the branch name. We deleted the local branch, then re-checked it under a new name without the comma. We were able to merge it successfully.
It may happen because that branch is not on your local. before merging use