I made some changes. Now after several commits and probably merges I want to revert a specific file back to a particular commit state in the workspace.
What is an appropriate git command?
I made some changes. Now after several commits and probably merges I want to revert a specific file back to a particular commit state in the workspace.
What is an appropriate git command?
You can revert a particular commit's state of the file back to the workspace with the following git command:
git checkout <COMMIT#> <relative/path/to/your/file>
Example:
git checkout 22864c16a5647d3b4ccb034aa5698f196a648a38 Gemfile
You can execute:
git checkout 0e97a7045e0b234efe5062600905468430ede879
The aproach above will move the pointer to this commit, but the branch will appears with the name like (HEAD detached at 147e81b7), or you can will to path .git\refs\reads find your branch and change the UUID there for your hash commit. This approach is the better IMO. To a single file you can execute the command line like @Roman sad
git checkout 22864c16a5647d3b4ccb034aa5698f196a648a38 Gemfile