本文介绍了在执行git difftool --dir-diff后,出于某种原因修改了文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行git difftool --dir-diff后,由于某些原因修改了我的工作区文件.我一直猜测它正在转换crlflf等之间的行尾.但是,做"git config core.autocrlf false或" git config --global core.autocrlf false并没有什么区别.我尝试同时使用windiff和作为自定义差异工具无法比较,但是它无济于事,这很糟糕,因为每次我查看.csproj文件中的某些更改时,都会重新加载该项目,因为它说该文件已在外部进行了修改.有什么想法吗?

After doing git difftool --dir-diff, my workspace files are modified for some reason. I've been guessing that it's converting the line endings between crlf and lf etc... However, doing "git config core.autocrlf false" or "git config --global core.autocrlf false" don't make any difference. I have tried using both windiff and beyond compare as the custom diff tool but it doesn't help. This is bad since every time I view some changes in my .csproj file, the project is reloaded since it said the file has been modified externally. Any ideas?

推荐答案

可以声明自动转换的唯一其他方法是通过 .gitattributes文件(请参阅 gitattributes ):

The only other way an automatic conversion can be declared is through .gitattributes file (see gitattributes):

  • with directives like *.txt eol=lf ("Git: Default all text files to unix line breaks") or * text=auto ("Force LF eol in git repo and working copy")
  • with content filter (smudge script)

这篇关于在执行git difftool --dir-diff后,出于某种原因修改了文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 21:01