Last active
August 29, 2015 14:24
-
-
Save guillermoroblesjr/976c0661a3c07d049a46 to your computer and use it in GitHub Desktop.
Reverting a file(s) to a specific Git commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # find the file w/path you want to revert | |
| find <a-parent-directory-of-file> -name "<name-of-file>" | |
| # get all commits (hashes) where changes were done to this specific file | |
| git log --abbrev-commit --pretty=oneline <path-to-your-file> | |
| # revert this file (while keeping changes in the history) to this hash | |
| git checkout <hash> <path-to-your-file> | |
| # do a 'git add' and 'git commit' | |
| # view the commits on the file (all are still there, yours is the most recent) | |
| git log --abbrev-commit --pretty=oneline <path-to-your-file> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment