Using git, how do you reset the working tree to the state of the index?

后端 未结 4 923
伪装坚强ぢ
伪装坚强ぢ 2020-12-23 19:02

Situation:

  1. Edit files
  2. Add files to the index
  3. Edit more files

Now we have three different states. The state of HEAD, the state

4条回答
  •  温柔的废话
    2020-12-23 19:25

    I tend to use git checkout . which discards all changes from the working directory down. This makes a difference if you're not at the root of the repository.

    This command doesn't remove newly created files which is usually a good thing. If you need to do this then you can use git clean as well.

提交回复
热议问题