Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does "not something we can merge" arise?

Tags:

git

git-merge

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 
like image 794
Hamish Downer Avatar asked Jan 17 '13 21:01

Hamish Downer


People also ask

Does it matter which way you merge?

Usually it does not matter if both branches are topic or feature branches. However, if you have an integration branch or a branch that marks what's been published, you definitely want to use the long lived integration branch as the one that's checked out and merge the other one into it.

Can a merge be undone?

You can undo a Git merge using the git reset –merge command. This command changes all files that are different between your current repository and a particular commit. There is no “git undo merge” command but the git reset command works well to undo a merge.

How do I merge without committing?

OPTIONS. Perform the merge and commit the result. This option can be used to override --no-commit. With --no-commit perform the merge and stop just before creating a merge commit, to give the user a chance to inspect and further tweak the merge result before committing.

What is merge strategy?

A merge happens when combining two branches. Git will take two (or more) commit pointers and attempt to find a common base commit between them. Git has several different methods to find a base commit, these methods are called "merge strategies".


1 Answers

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.

like image 199
KingCrunch Avatar answered Nov 06 '22 22:11

KingCrunch