From here.
If you already stage you local changes(which means you run the “git add xxx” already), you should reset the buffer zone first:
1 | git reset HEAD hello.html |
Now the buffer zone of the branch you’re working on is reset, but you local file still has the changes. Use the “checkout” command to discard your local file changes(If you didn’t stage your local changes as step 1 described, just do this step):
1 | git checkout hello.html |
Now you local changes is totally discarded.