Revert File to Commit
To revert (or reset) the content of one or more files to a specific commit, you can use following command:
To determine the <commit>-ID of the desired commit, you may use some kind of git log --format=oneline <file-path> combined with grep.
This places the target file contents directly into the index.
git checkout <commit> -- <file-path-1> <file-path-2> ... Considerations
- If there are any changes for these files in the working tree or index, they will be overwritten without warning! Therefore, it is advisable to (selectively) stash away working tree and index changes beforehand using
git stash.