我有一个修改过的文件,我想恢复到最新提交中的任何内容,但它“卡在”那里,总是被标记为已修改。
$ 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: index.php
#
no changes added to commit (use "git add" and/or "git commit -a")
然后我尝试:
$git checkout -- index.php
但 git status 的输出仍然是一样的。然后我尝试:
$git reset --hard master
HEAD is now at 02c9613 test commit message
git status 的输出仍然是相同的。
关于如何摆脱该文件的假定更改有什么想法吗?
您可能会遇到空格问题 http://www.google.nl/search?q=git+ignore+whitespace try git config --global apply.whitespace nowarn
为了那个原因。
如果这不起作用,我会说你遇到了错误。保存本地克隆以供将来参考(我希望它不要太大)并创建错误报告。尤其是以下事实:
有迹象表明可能不是您在这里犯了错误。是否可以在干净的存储库上重现该问题也将是有趣的信息。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)