Tech Blog :: How to undo a file in a previous commit with Git
How to undo a file in a previous commit with Git
Suppose you've made a bunch of commits in a Git repository, and need to undo the changes made to a specific file. git revert, git checkout, and git reset can all be used to undo/revert changes in different stages (see here), but this syntax seems to be best when individual files need to be rolled back:
git checkout REV -- path/to/file
where REV is the SHA of the last good commit
Google: TheBuckSt0p
Facebook: BenBuckman
LinkedIn
Github: newleafdigital
@thebuckst0p
Delicious: thebuckst0p
Drupal.org: thebuckst0p
Post new comment
Don't bother putting in spam links. They'll be set to
rel=nofollowand will be removed and reported as spam shortly after submitting.