Wic*_*ams 6 git rollback git-stash git-reset
我只想回到一个干净的工作目录,就像我上次提交后一样.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")
Run Code Online (Sandbox Code Playgroud)
然后我尝试建议的内容以及我能找到的其他内容:
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")
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,尽管有回滚,但没有任何变化.
所以然后我遵循建议并且运行了一个忽略所有空间的差异,并且怀疑它似乎在忽略空格时没有差异 - 所以我想这是行结尾!我该怎么做才能解决这个问题?我已经设定autocrlf到true无济于事.