git重置后留下未更新的变化--hard [英] Unstaged changes left after git reset --hard

查看:94
本文介绍了git重置后留下未更新的变化--hard的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b

之后> git reset --hard git status 给我的文件在中没有为commit提交:节。



我也试过 git reset。 git checkout - 。 git checkout- index -f -a ,无济于事。



那么,我该如何摆脱那些未分离的变化?



这似乎只打击了Visual Studio项目文件。奇怪的。查看此贴: http://pastebin.com/eFZwPn9Z 。这些文件的特殊之处在于.gitattributes中有:

  *。sln eol = crlf 
* .vcproj eol = crlf
* .vcxproj * eol = crlf

另外, autocrlf 在我的全局 .gitconfig 中设置为false。这可能有点相关?

解决方案

好的,我解决了这个问题。



它似乎是 .gitattributes 文件,其中包含:

  *。sln eol = crlf 
* .vcproj eol = crlf
* .vcxproj * eol = crlf

使项目文件显示为不冻结。我无能为力,我真的希望有人知道git的方式会给我们一个很好的解释。



我的修复是删除这些文件,并在 .git / config 中添加 autocrlf = false [core] code $。

这与前面的配置不完全一样,因为它要求每个开发者都有 autocrlf =假。我想找到一个更好的解决方案。



编辑:



我评论了这些罪证行,它的工作。什么......我甚至不......!


The title says it all.

After git reset --hard, git status gives me files within the Changes not staged for commit: section.

I've also tried git reset ., git checkout -- . and git checkout-index -f -a, to no avail.

So, how can I get rid of those unstaged changes?

This seems to hit only Visual Studio project files. Weird. See this paste: http://pastebin.com/eFZwPn9Z. What is special with those files, is that in .gitattributes I have:

*.sln        eol=crlf
*.vcproj     eol=crlf
*.vcxproj*   eol=crlf

Also, autocrlf is set to false in my global .gitconfig. Could that be somehow relevant?

解决方案

Okay, I've kind of solved the problem.

It seemed that the .gitattributes file, containing:

*.sln        eol=crlf
*.vcproj     eol=crlf
*.vcxproj*   eol=crlf

made the project files appear unstaged. I am clueless why that is, and I'm really hoping that someone privy to the ways of git will give us a nice explanation.

My fix was to remove these files, and to add autocrlf = false under [core] in .git/config.

This does not amount to exactly the same thing as the previous configuration, as it requires every dev to have autocrlf = false. I'd like to find a better fix.

EDIT:

I commented the incriminating lines, uncommented them and it worked. What the ... I don't even ... !

这篇关于git重置后留下未更新的变化--hard的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆