4

I have a very strange situation with GIT, first time see this. So basically in version control it shows me that i have one changed file. This file is an svg: file_test.svg

When i revert it, it just replaces this file with File_Test.svg. If i try to revert File_Test.svg, it replaces it back with file_test.svg and so on...

So, how that is possible, i didn't touch this svg file + why i can't revert it. Maybe guys you've seen this problem before, how did you resolve it?

ConstantinEx
  • 160
  • 3
  • 16
  • And you're literally just running "git revert" ya? – jhaagsma Oct 03 '18 at 20:08
  • git revert option from WebStorm, also git checkout -- file_test.svg – ConstantinEx Oct 03 '18 at 20:12
  • You could always try `git reset HEAD` if you're trying to just get back to the previous commit's version. – jhaagsma Oct 03 '18 at 20:19
  • This is a local change, i didn't change/touch this file, i didn't commit it to do git reset HEAD – ConstantinEx Oct 03 '18 at 20:23
  • Do you have this file opened by some other tools or editors? – Ortomala Lokni Oct 03 '18 at 20:26
  • @OrtomalaLokni, no, of course no – ConstantinEx Oct 03 '18 at 20:27
  • 1
    Perhaps the repository has both `File_Test.svg` and `file_test.svg` with different capitalization. Anybody working in linux will see two files, people working in Windows will get very strange behaviour. – Mort Oct 03 '18 at 20:28
  • @Mort there is just one file, i've checked this for sure! – ConstantinEx Oct 03 '18 at 20:32
  • How did you check? – OhleC Oct 03 '18 at 20:53
  • 1
    Besides the "two files with one case" issue, there's also "one file with two different cases", which occurs in the opposite direction, on Windows. The Linux user will experience the different cases consistently, while the Windows user will get whichever case was last successfully created in the work-tree (not random, really, but it kind of *seems* random, though you'll get this alternating behavior a lot). – torek Oct 03 '18 at 20:55
  • I'm having the exact same problem with my svgs. I have not found a solution other than to commit the changes git thinks it found. – jenlampton Dec 14 '20 at 20:39

1 Answers1

0

To reset local changes for a specific file you can use the command:

git checkout -- pathToFile

When you add this file by mistake you need to use

git reset HEAD pathToFile
Patryk Rudnicki
  • 755
  • 1
  • 8
  • 21