Tommy B
Tommy B

Reputation: 185

Git merge issue(s)

I'm pretty new to git so I'm still getting my bearings with the tool.

I have a "small" problem involving a merge. Basically the timeline is as follows:

  1. Did a rebase from SVN using git-svn bridge
  2. Had conflicts which I merged, but never committed
  3. Did other work...lots of it and committed a number of other changes
  4. Tried to push and got "fatal: you have not concluded your merge MERGE_HEAD exists"
  5. I did a "git reset --merge ORIG_HEAD" as recommended at http://www.btaz.com/scm/git/git-fatal-you-have-not-concluded-your-merge-merge_head-exists/
  6. Fixed merge issues
  7. Foolishly committed changes and pushed

Now I realize that a bunch of changes have gone missing in the last merge and I'm wondering how best to undo the merge and get git to allow me to push my changes to origin?

I hope I've made the issue clear...if not beat me over the head

Upvotes: 1

Views: 473

Answers (2)

Patrick O'Hara
Patrick O'Hara

Reputation: 571

Using the git reflog command previously mentioned find your "lost" commits. You can use git show to review each commit. I would then suggest cherry picking those commits into your current branch with the completed merge one at a time. Obviously you should test as you go (you do have unit tests don't you? :-). Once you have picked all the commits you are free to push your changes.

Upvotes: 0

Thunder Rabbit
Thunder Rabbit

Reputation: 5449

I'm not clear on exactly how to fix it, but git reflog is quite a powerful tool. It will show you everything that's happened to the repo. Then, for example, you can cherry-pick commits from history even if they're not in the working master branch.

Upvotes: 2

Related Questions