Let's suppose you edited a file on the production working directory, but didn't commit it. On your last push, you edited it, and the changes in production aren't needed anymore. So, your goal is to erase changes on this file and reset the file to the last committed version:
This command is really nice if you want to restore a deleted file. You can also specify a commit pointer to use (useful if you stash [1] your changes):
$ git checkout myfile.txt
$ rm myfile.txt
$ git checkout HEAD myfile.txt
No comments:
Post a Comment