How to revert uncommitted changes including files and folders?

前端 未结 14 1819
小鲜肉
小鲜肉 2020-11-28 17:07

Is there a git command to revert all uncommitted changes in a working tree and index and to also remove newly created files and folders?

14条回答
  •  半阙折子戏
    2020-11-28 17:43

    If you want to revert the changes only in current working directory, use

    git checkout -- .
    

    And before that, you can list the files that will be reverted without actually making any action, just to check what will happen, with:

    git checkout --
    

提交回复
热议问题