How to remove local (untracked) files from the current Git working tree

前端 未结 30 2738
死守一世寂寞
死守一世寂寞 2020-11-22 00:07

How do you delete untracked local files from your current working tree?

30条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 00:57

    If you just want to delete the files listed as untracked by 'git status'

    git stash save -u
    git stash drop "stash@{0}"
    

    I prefer this to 'git clean' because 'git clean' will delete files ignored by git, so your next build will have to rebuild everything and you may lose your IDE settings too.

提交回复
热议问题