35

This is a new one to me. I'm a fairly experienced user of git, and have just added a remote to a repo that was forked from mine, fetched the updates and then tried to merge them in:

$ git merge HEAD f6ff240dbf47234249a68b34c8a98bb11237aa7
fatal: f6ff240dbf47234249a68b34c8a98bb11237aa7 - not something we can merge

There is next to nothing on the web about this error message, which shocks me. The nearest thing I can find is this page about being in a detached head state. But git status reports that I am on branch master.

You can see the repositories I am trying to use on github - my repo and the remote I want to pull from. At the time of writing, master of my repo is at 6dc048862a93ffba6cd37883fd43e40651f248c1.

Looking at the history I can see where the forks diverge, and I am trying to merge a commit from 3 commits up the fork. It doesn't seem that hard.

To replicate for yourself you could do:

git clone https://github.com/aptivate/dye
cd dye
git remote add qris git://github.com/qris/ping-dye.git
git fetch qris
git checkout master
git merge f6ff240dbf47234249a68b34c8a98bb11237aa7
KingCrunch
  • 128,817
  • 21
  • 151
  • 173
Hamish Downer
  • 16,603
  • 16
  • 90
  • 84
  • In my case, the message is a usual `fatal: 'f6ff240dbf47234249a68b34c8a98bb11237aa7' does not point to a commit` – bereal Jan 17 '13 at 21:47
  • Different client versions? I got `not something we can merge` too. I use 1.7.10 – KingCrunch Jan 17 '13 at 21:52
  • I'm on 1.7.10.4 and got the message above. @bereal 's message would have been more useful. – Hamish Downer Jan 17 '13 at 22:01
  • Ah, that explains it, I'm on 1.7.9.5. – bereal Jan 18 '13 at 06:47
  • 1
    Thanks, similar problem arose for me when using pull request on bitbucket, they suggest that the user run a command like: `git merge --no-ff -m 'Merged in hotfix (pull request #1)' remotes/username/project/hotfix` but locally `remotes/username/project/hotfix` doesn't exist and you need to edit it to be `origin/hotfix` – pulkitsinghal May 20 '13 at 22:28

3 Answers3

21

It's quite simple: f6ff240dbf47234249a68b34c8a98bb11237aa7 doesn't exist.

I just realize you mean 3f6ff240dbf47234249a68b34c8a98bb11237aa7 (Note the missing 3 at the beginning) Just go to the commit list and type Ctrl+f f6ff.

If that is someone you know, you should tell them to always branch from master and commit their custom changes there (for every change), instead of committing directly into master. Then he doesn't need to rebase and force-push the changes from upstream (you) and you only have to merge the specific story-branches.

KingCrunch
  • 128,817
  • 21
  • 151
  • 173
  • 1
    Just checked and you're right - some how I missed the 3 off the front of the commit ID. D'oh. Still not the most helpful error message. Maybe your answer will help some future idiot like me ;) Thank you. – Hamish Downer Jan 17 '13 at 21:48
  • 1
    This might sound stupid but I got this error cause the branch I was attempting to merge TO did not exist. I had previously deleted it and simply forgotten. – Ian G Jan 13 '19 at 18:00
  • 1
    In my case, it was a branch name and the solution to prefix it with `origin/` because it was a remote branch that I hadn't locally in my working copy. – CodeManX Jul 17 '19 at 10:15
3

I got a same error message. In my case, the reason is I use '(' and ')' in branch name.

Sendor.Wang
  • 91
  • 1
  • 3
3

I get the error if I use the wrong quotes (HEX UTF-8 bytes E2 80 9C and HEX UTF-8 bytes E2 80 9D) instead of the simple quote (HEX UTF-8 bytes 22) to enclose the commit message, see below.

Master@HP-ENVY-L MINGW64 ~/desktop/learning/git-practice/p_2 (master)
$ git merge feature-branch -m “Merge feature-branch into master”
merge: into - not something we can merge

Master@HP-ENVY-L MINGW64 ~/desktop/learning/git-practice/p_2 (master)
$ git merge feature-branch -m "Merge feature-branch into master"
Already up-to-date.

It happened because I copied and pasted the command from instructions instead of typing it in myself. The message git provides is rather unspecific.

Btuman
  • 881
  • 2
  • 9
  • 37
Sealis
  • 31
  • 4