How to revert uncommitted changes including files and folders?

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

    Use "git checkout -- ..." to discard changes in working directory

    git checkout -- app/views/posts/index.html.erb
    

    or

    git checkout -- *
    

    removes all changes made to unstaged files in git status eg

    modified:    app/controllers/posts.rb
    modified:    app/views/posts/index.html.erb
    

提交回复
热议问题