Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo single-file local uncommitted change in egit (e.g. svn revert) [duplicate]

Tags:

eclipse

egit

Scenario: I have local uncommitted changes to a source file which I want to undo, and get the source file back in its pristine state. In command-line git I would do "git checkout ", but how do I do this in Egit?

like image 377
JesperE Avatar asked Jul 22 '11 10:07

JesperE


People also ask

How do you undo uncommitted changes?

Try Git checkout --<file> to discard uncommitted changes to a file. Git reset --hard is for when you want to discard all uncommitted changes. Use Git reset --hard <commit id> to point the repo to a previous commit.

How do I undo changes to a file?

If you have committed changes to a file (i.e. you have run both git add and git commit ), and want to undo those changes, then you can use git reset HEAD~ to undo your commit.


1 Answers

See this answer: https://stackoverflow.com/a/4104149/152061 (send upvotes there)

Right click on the file -> Replace With -> Index 

(old versions might say File in Git Index rather than Index)

or if you want to undo all files that have changed, right click on the project -> Team -> Reset.. -> select the 'hard' radio button -> press the Reset button

like image 84
Brad Cupit Avatar answered Oct 05 '22 22:10

Brad Cupit