4

I have a modified file in a Git working directory which I want to discard. This file is not in a submodule.

I tried 3 different commands and nothing helped.

  1. git checkout -- <file>, or git checkout <file>

  2. git reset HEAD --hard

  3. git stash save --keep-index

How to discard that file?

Screenshots:

enter image description here enter image description here

Mando
  • 11,414
  • 17
  • 86
  • 167

1 Answers1

1

As long as you set git config --global core.autocrlf true, you will see changes applied automatically to those file.

I would recommend:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250