I have made some changes to a file which has been committed a few times as part of a group of files, but now want to reset/revert the changes on it back to a previous versio
Many suggestions here, most along the lines of git checkout $revision -- $file
. A couple of obscure alternatives:
git show $revision:$file > $file
And also, I use this a lot just to see a particular version temporarily:
git show $revision:$file
or
git show $revision:$file | vim -R -
(OBS: $file
needs to be prefixed with ./
if it is a relative path for git show $revision:$file
to work)
And the even more weird:
git archive $revision $file | tar -x0 > $file