This could be a very simple question. I commited my work, then I launched a find and replace script but I want to undo it, so to let my work go down to the actual commit. What is the right command to do that : I know about git reset soft/hard or git amend but it is not appropriate
Asked
Active
Viewed 49 times
0
-
Why is git reset --hard not appropriate? – bwroga Jan 31 '13 at 13:52
-
Why is `git reset --hard HEAD` not appropriate? It ditches all your modifications, leaving you at the state of `HEAD`. – Michael Wild Jan 31 '13 at 13:52
-
@MichaelWild I thought git reset--hard would undo the current commit, no ? – user1611830 Jan 31 '13 at 14:00
-
1No, `git reset --hard HEAD^` does (notice the carret). – Michael Wild Jan 31 '13 at 14:03
-
ah ok thanks I didn't notice ! – user1611830 Jan 31 '13 at 14:27
1 Answers
2
You have a couple of options:
As the comments state git reset --hard
will bring everything back.
But if you want to keep some of the files modified then doing:
git checkout -- <filename>
Will undo individual files.

Schleis
- 41,516
- 7
- 68
- 87
-
Ouah, I put git reset --hard, I indeed went to my last commit but all the modifications I commited disappear. I don't know what screwed up, is oit possible to find the history of files including what they were after git reset --hard – user1611830 Jan 31 '13 at 14:50
-
Git reset --hard undoes all your changes. If you did not commit the changes, there is no way to see them. http://www.kernel.org/pub/software/scm/git/docs/git-reset.html – Schleis Jan 31 '13 at 15:23