delete untracked files with git clean

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

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

ps

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

Reference: https://git-scm.com/docs/git-clean

Disclaimer
  1. License under CC BY-NC 4.0
  2. Copyright issue feedback: dig +short txt issue.imzye.com
  3. Not all the commands and scripts are tested in production environment, use at your own risk
  4. No privacy information is collected here
Buy Me a Coffee