git reset --hard只能删除tracked的工作区文件,未跟踪的貌似删不掉,我在stack overflowshang找到了一个答案:https://stackoverflow.com/questions/61212/how-to-remove-local-untracked-files-from-the-current-git-working-tree
As per the Git Documentation git clean
Remove untracked files from the working tree
Step 1 is to show what will be deleted by using the -n option:
git clean -n
Clean Step - beware: this will delete files:
git clean -f
- To remove directories, run git clean -f -d or git clean -fd
- To remove ignored files, run git clean -f -X or git clean -fX
- To remove ignored and non-ignored files, run git clean -f -x or git clean -fx