Reputation: 262494
I have merged two of my branches (using the Eclipse merge tool).
When I commit, the commit has only one of the branches as parents (the original workspace HEAD). I'll dig into why that happens later, but I need to commit this properly right now (there was lot of work involved in the merge).
How can i amend the commit to include the reference to the other branch? The file contents are all good now, I just want to have the commit have two parents.
Upvotes: 2
Views: 427
Reputation: 34407
First, if you have already committed, run git reset --soft HEAD^
to undo it.
Method 1
Create MERGE_HEAD
file in GIT_DIR
(usually /.git
) which contains SHA-1
of the tip of the branch (you can get it using git show-ref
) you are merging with (and an empty line, just to mimic git merge
behavior). And commit as usual.
Method 2
Also, you can do it without messing with git internals, if you prefer:
.git
directory) somewheregit reset --hard
git merge branch_to_merge_with --no-commit
.git
directory)P.S. it could happen if you've used git merge --squash
option or MERGE_HEAD
file was lost somehow.
Upvotes: 3