git checkout -- <file>
命令,由于容易漏了--导致和切换分支混肴,所以新版本中:git restore (--worktree) <file>
命令从暂存区恢复工作区git restore --staged <file>
从当前版本库中恢复暂存区git restore --source=HEAD --staged --worktree <file>
从当前版本库中同时恢复工作区和暂存区原文:https://www.cnblogs.com/linzedian/p/13190983.html