Question

I changed an image file in git and it was 2 commits ago. How do I go back to 2 previous commits ago?

What is the easiest method of doing this file revert via the command line with the least amount of commands required?

Was it helpful?

Solution

Just check out the old version of that file:

git checkout HEAD~2 -- path/to/file

Or more explicit:

git checkout commit-id -- path/to/file
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top