0

Using Eclipse Git (the one bundled by default on Eclipse Mars.1 - JavaEE version), is it still possible to remove/delete a wrong merge commit?

Since I'm still new to the UI of Eclipse Git coming from a terminal user, I accidentally merge the wrong branch dev-release to a dev-master. Which should have been the other way around. Luckily I haven't pushed yet that merge commit to remote.

My question is, is it possible to undo the merge commit using Eclipse Git only?

Git history

Current situation

dev-release      E - F - G 
               /           \
dev-master   A - B - C - D - H

Expected result

dev-release      E - F - G - H 
               /           /
dev-master   A - B - C - D 
David B
  • 3,269
  • 12
  • 48
  • 80

1 Answers1

0

You should be able to hard reset dev-master to commit D from the History View then redo the merge on dev-release as you wanted.

Yuval Adam
  • 161,610
  • 92
  • 305
  • 395
  • So from `dev-master`, I'm going to hard reset down to `D`. After that, checkout to `dev-release` then merge `dev-master`? But I think `H` commit from current situation still exists on the history. – David B Nov 20 '15 at 14:04
  • 1
    After you hard-reset dev-master to D, the H commit will remain there, but no one will point to it. dev-master's head will point to D. When you merge again a new commit will be created. From a git point of view, the H commit will look like a third nameless branch no one is using, and eventually will be garbage collected. – Jens Nov 20 '15 at 14:43