Git重置改动汇总

来源:互联网 发布:手机常用的网络制式 编辑:程序博客网 时间:2024/05/22 16:38

重置所有改动

git resetgit checkout .git clean -fdx

  • Unstage all files you might have staged with git add
git reset
  • This will revert all local uncommitted changes (should be executed in repo root):
git checkout .
  • Revert uncommitted changes only to particular file or directory:
git checkout file.path
  • Another way to revert all uncommitted changes (longer to type, but works from any subdirectory):
git reset --hard HEAD
  • Remove all local untracked files, so only git tracked files remain:
git clean -fdx

WARNING: -x will also remove all ignored files

0 0
原创粉丝点击