Sometimes we make attempts that go nowhere or simply edit the wrong file. When this happens it is nice to just “undo” what I did and revert the file back to the last good state (I assume the state I have gotten/pushed to is good).
I can revert the file to the latest version
git checkout -- the.file |
Or I can revert it to the latest version from the HEAD revision
git checkout HEAD the.file |
Or I could do it for the entire working tree
get reset --hard HEAD |