Failed to reset to clean working directory in git

I cannot reset one particular file in the git working directory for some reason, beyond my understanding!

Here:

Now I am doing git reset - hard,

$ git reset --hard HEAD is now at 97b3164 Added clojure jars for personal tracking and also set clo jure classpath in jaskirat.el 

After hard reset:

  $ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: elpa-to-submit/color-theme.el # no changes added to commit (use "git add" and/or "git commit -a") 

I also tried git checkout - elpa-to-submit / color-theme.el but nothing returns me to a "clean" uninstalled working directory !: -S

Note. I have a clone of this repo from github on a Linux desktop and I don't see such problems on my desktop

+4
source share
3 answers

From your feedback, git diff is an EOL problem. Windows uses \r\n , while Linux uses \n . See the settings core.eol , core.safecrlf and core.autocrlf in git-config(1) .

+8
source

He tried his features so as not to lose your data. This file has been modified in your working copy.

If you really, really don't care about changes to this file, use

 git checkout -- elpa-to-submit/color-theme.el 

to restore a file to a version from HEAD (note that this is correctly indicated in the git status message).

0
source

What happens when you do this:

 git reset --hard HEAD git checkout -- * 
0
source

Source: https://habr.com/ru/post/1336670/


All Articles