Skip to content

delete untracked files with git clean

用于批量删除branch中新加的文件 untracked files

git clean -nxdf
git checkout . && git clean -xdf


## dryrun 检查哪些文件待删除
git clean -n
## 删除当前目录下没有被track过的文件和目录
git clean -df
## 删除当前目录下所有没有track过的文件,包含.gitignore文件里面的文件和目录
git clean -xf


  1. License under CC BY-NC 4.0
  2. Copyright issue feedback, replace # with @
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Try iOS App