由于某种原因,我无法在我的git工作目录中重置一个特定文件!
这里是:
我做了一个git reset - 现在哈哈,
$ git reset --hard
HEAD is now at 97b3164 Added clojure jars for personal tracking and also set clo
jure classpath in jaskirat.el
硬重置后:
$ 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")
我也尝试过git checkout - elpa-to-submit / color-theme.el 但似乎没有什么能让我回到“干净”的未分级工作目录! :-S
注意:我的linux桌面上也有来自github的这个repo的克隆,我在桌面上看不到这样的问题
答案 0 :(得分:8)
根据您的git diff
反馈,这似乎是EOL问题。 Windows使用\r\n
,而Linux使用\n
。请参阅core.eol
中的core.safecrlf
,core.autocrlf
和git-config(1)
设置。
答案 1 :(得分:0)
它正在努力避免丢失您的数据。此文件已在您的工作副本中修改。
如果你真的,真的不关心对该文件的更改,请使用
git checkout -- elpa-to-submit/color-theme.el
将文件从HEAD恢复到其版本(注意它在git状态消息中说明了这一点。)
答案 2 :(得分:0)
执行此操作时会发生什么:
git reset --hard HEAD
git checkout -- *