git checkout all the files

前端 未结 2 1066
無奈伤痛
無奈伤痛 2020-12-22 17:03

How can I get rid of all the changes in all the files of my repository?

Say I am in a branch and I did some changes. git status returns

相关标签:
2条回答
  • 2020-12-22 17:20

    Other way which I found useful is:

    git checkout <wildcard> 
    

    Example:

    git checkout *.html
    

    More generally:

    git checkout <branch> <filename/wildcard>
    
    0 讨论(0)
  • 2020-12-22 17:37

    If you are at the root of your working directory, you can do git checkout -- . to check-out all files in the current HEAD and replace your local files.

    You can also do git reset --hard to reset your working directory and replace all changes (including the index).

    0 讨论(0)
提交回复
热议问题