jobukkit
jobukkit

Reputation: 2670

How to delete commits with egit?

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.

Upvotes: 28

Views: 63339

Answers (2)

VonC
VonC

Reputation: 1323573

Note that Egit3.0 in Kepler allows you to hard reset to any treeish expression you want:

enter image description here

But once hard reset, you still need to git push --force after that: if you don't the history of your upstream repo would still list that commit.

Upvotes: 5

Frank
Frank

Reputation: 1133

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.

Upvotes: 41

Related Questions