How to revert uncommitted changes including files and folders?

前端 未结 14 1763
小鲜肉
小鲜肉 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:27

    You can run these two commands:

    # Revert changes to modified files.
    git reset --hard
    
    # Remove all untracked files and directories.
    # '-f' is force, '-d' is remove directories.
    git clean -fd
    

提交回复
热议问题