I want to do exactly what Undo working copy modifications of one file in Git? is asking, and I want to do exactly what How to remove local (untracked) files from the current Git working tree is asking, but I want it in a single command that works regardless of the git status of the file. Does such a command exist?
- Is it staged? Don't care -- after this command, it looks like the latest commit.
- Is it not staged? Don't care -- after this command, it looks like the latest commit.
- Is it unstaged? Don't care -- after this command, it looks like the latest commit (i.e., delete the file since it's not a part of the last commit).
I don't want to think! Just... undo the changes. Does git have a single command that'll do all three? If not, is there a way to write a git alias that can safely do this on any file/dir?