【问题标题】:Git equivalent for GitHub Desktop's "Discard all changes" (not git stash though) [duplicate]GitHub Desktop 的“放弃所有更改”的 Git 等效项(虽然不是 git stash)[重复] 【发布时间】:2021-10-26 01:37:12 【问题描述】: GitHub Desktop 有一个不错的功能,名为“放弃所有更改” 我如何使用 Git CLI 做同样的事情,但 不 使用 git stash? 【问题讨论】: 如“摆脱自上次提交以来的所有更改”? 标签: git github-desktop 【解决方案1】: 使用: 最近的git restore command magic pathspec :/ 那就是,从您的存储库中的任何地方: git restore -SW :\ 这会将您的工作树和索引恢复到 HEAD 内容 【讨论】: