How to resolve git's “not something we can merge” error

前端 未结 25 1126
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 05:42

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-n

相关标签:
25条回答
  • 2020-12-04 06:21

    In My case, the Problem was in Branch Name. My new branch name contains brackets, Once I renamed it and remove brackets, It's sorted.

    0 讨论(0)
  • For me the problem occured when I tried this:

    git merge -s ours --no-commit --allow-unrelated-histories <remote name>/develop
    

    So actually I should have written master instead of develop,because master was the branch name of Subtree,not my actual branch.

    0 讨论(0)
  • 2020-12-04 06:22

    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:

    git checkout branch-name
    git pull
    git checkout new-branch-name
    git merge branch-name
    
    0 讨论(0)
  • 2020-12-04 06:22

    I had the same problem... I am a complete beginner In my case it happened cause I was trying to do: git merge random_branch/file.txt My problem was solved when I retired the file.txt and let just the branch name (lol) kkfdskfskdfs

    git merge random_branch worked pretty well

    0 讨论(0)
  • 2020-12-04 06:24

    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.

    0 讨论(0)
  • 2020-12-04 06:24

    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.

    0 讨论(0)
提交回复
热议问题