我只想回到一个干净的工作目录,就像我上次提交之后一样。Git 向我报告了我没有进行的大量文件修改,所以我怀疑这与行尾有关。
我已经尝试了所有常见的嫌疑人来做到这一点:
git reset --hard
git commit -- .
git stash
git clean -fd
无论我做什么,git status
总是显示与已修改相同的文件。我能做些什么?我在另一个分支中隐藏了未提交的更改,所以我不想只是炸掉所有东西,而只是“回滚”我的主分支。
编辑:输出
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: demo/index.html
# modified: demo/js/app.js
# modified: demo/js/libs/jquery.1.7.1.js
# modified: demo/js/libs/matchMedia.js
# modified: demo/js/libs/modernizr.js
# modified: demo/js/loadr.js
# modified: dist/enquire.js
# modified: src/include/intro.js
#
no changes added to commit (use "git add" and/or "git commit -a")
然后我尝试建议的内容以及我能找到的所有其他内容:
WickyNilliams at Nick MBA in ~/Repositories/enquire on master*
$ git checkout -- .
WickyNilliams at Nick MBA in ~/Repositories/enquire on master*
$ git reset --hard
HEAD is now at d70fee4 added meta tag to test demo on mobile #10
WickyNilliams at Nick MBA in ~/Repositories/enquire on master*
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: demo/index.html
# modified: demo/js/app.js
# modified: demo/js/libs/jquery.1.7.1.js
# modified: demo/js/libs/matchMedia.js
# modified: demo/js/libs/modernizr.js
# modified: demo/js/loadr.js
# modified: dist/enquire.js
# modified: src/include/intro.js
#
no changes added to commit (use "git add" and/or "git commit -a")
如您所见,尽管回滚,但没有任何变化。
所以然后我听从了建议并运行了一个忽略所有空格的差异,并且怀疑它在忽略空格时似乎没有区别 - 所以我猜它是行尾!我能做些什么来解决这个问题?我已经设置为autocrlf
无济于事true
。