How to revert uncommitted changes including files and folders?

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

    Git 2.23 introduced git restore command to restore working tree files.

    https://git-scm.com/docs/git-restore

    To restore all files in the current directory

    git restore .

    If you want to restore all C source files to match the version in the index, you can do

    git restore '*.c'

提交回复
热议问题