How to delete commits with egit?

爷,独闯天下 提交于 2019-11-27 11:12:57

问题


I just made some bad commits with egit that I would like 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.

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.


回答1:


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.




回答2:


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

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.




回答3:


You can do a hard reset but be carefull with that !! Here's some more info: Delete commits from a branch in Git



来源:https://stackoverflow.com/questions/13534336/how-to-delete-commits-with-egit

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!