How to delete commits with egit?

stommestack picture stommestack · Nov 23, 2012 · Viewed 49.7k times · Source

I just made some bad commits with egit that I would like to delete.

Some bad commits I want to delete

How do I delete commits from egit?

Thanks!

EDIT: I tried a hard reset a few times but it didn't do anything. Hard reset screen

EDIT 2: Hard reset does rollback changes indeed, but I want them to completely disappear from the history as if I never made these commits.

Answer

Frank picture Frank · Dec 10, 2012

RightMouse on your Repository and click on "show in -> history". You should select the last commit before your last "fetch"...most of the time its the second commit under your current HEAD. RightMouse on that commit and "reset -> Hard" (will reset all your commits AND local workspace changes to the selected commit).

you should see the up-arrow changing into an down-arrow, meaning that your commits are deleted and that your repository is outdated. Use "fetch" & "rebase" to be up to date.