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

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

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

30条回答
  •  野性不改
    2020-11-22 00:52

    A lifehack for such situation I just invented and tried (that works perfectly):

    git add .
    git reset --hard HEAD
    

    Beware! Be sure to commit any needed changes (even in non-untracked files) before performing this.

提交回复
热议问题