Skip to content

Hard reset a single file

Sometimes you may accidentally edited a file and want to revert the change to the version it is on the remote. To do that, use the following command:

git checkout HEAD -- file.txt


Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.