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

Alexey Strakh
  • 11,069
  • 17
  • 79
  • 159

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,129,465
  • 480
  • 4,036
  • 4,755