DEV Community

Discussion on: Git and GitHub: How to Revert a Single File.

Collapse
 
gerrytan profile image
Gerry Tan

In most cases you want to checkout to the commit before the most recent ones. So the command should be:

git checkout [commit ID]~1 -- path/to/file

~1 here is reference to the commit's first parent, more info.