如果感觉命令多了记不住,那就为git配置两个别名,比如:

git config --global alias.unstage 'reset HEAD --'
git config --global alias.restore 'checkout --'

我们拿 README.md 这个文件举例,比如修改了一段文字描述,想恢复回原来的样子:

git restore README.md

执行上面命令即可,
如果修改已经被 git add README.md 放入暂存队列,那就要 依次执行 如下两条命令:

git unstage README.md
git restore README.md

 

如果不配置别名的话,命令应该为:

git reset HEAD -- README.md
git checkout -- README.md

补充

git checkout . 



原文链接:https://blog.csdn.net/qq_28867949/article/details/79497583

相关文章:

  • 2021-08-09
  • 2021-07-17
  • 2022-01-06
  • 2022-02-10
  • 2022-02-10
  • 2022-02-10
  • 2022-02-10
猜你喜欢
  • 2021-05-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案