git clean用法

首先确认要删除的文件
git clean -fd -n

如果以上命令给出的文件列表是你想删除的, 那么接下来执行

git clean -f -d或者git clean -fd就可以了。

其中-f表示文件-d表示目录, 如果还要删除.gitignore中的文件那么再加上-x (-x对我来说没用)

如果git submodule中也存在需要删除的文件那么需要再加个-f, 变成git clean -dff

详见:http://stackoverflow.com/questions/61212/how-do-i-remove-local-untracked-files-from-my-current-git-branch

你可能感兴趣的:(git clean用法)