Reputation: 18860
I have done several commits since I started to write the code. Unfortunately I have messed up one of the files (lets say it was "messFile.txt" ). I don,t want to reset entire repository. I am trying to revert state of only one file (from one of the old commit).
Can I do that?
I would be very grateful for your help guys, examples are very welcome.
Have a nice day.
Upvotes: 0
Views: 57
Reputation: 225172
Just check out that file from the commit you want to:
git checkout COMMIT_HASH -- FILENAME
Substitute for COMMIT_HASH
and FILENAME
as necessary. After you've checked the file out, you can add & commit it to get the old content back onto top-of-tree.
Upvotes: 2