Git状态忽略行结束符/相同的文件/窗口& linux环境/ dropbox / mled [英] Git status ignore line endings / identical files / windows & linux environment / dropbox / mled

查看:407
本文介绍了Git状态忽略行结束符/相同的文件/窗口& linux环境/ dropbox / mled的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我该如何制作


git status

忽略行结束区别?

背景信息:

我随机使用Windows和Linux工作在项目上。该项目是在Dropbox中。



我发现很多关于如何让git diff忽略行尾的问题。由于我使用融合git diff打开每个文件的meld。而融合说相同的文件。

那么我该如何避免这种情况呢? Git只能打开已更改文件的组合。
如果只有文件结尾不一样,那么git status不应报告文件被更改。



编辑:原因:



发生这种情况是因为Windows上的这个设置


core.autocrlf true


所以我检查了Linux上的工作副本并在Windows上设置了core.autocrlf false。


解决方案

改用.gitattributes代替,与以下设置:

 #忽略所有行结尾的差异
* -crlf

.gitattributes可以在与全局.gitconfig相同的目录中找到。如果.gitattributes不存在,请将其添加到该目录。添加/更改.gitattributes后,您必须重新设置存储库,以便成功将更改应用到现有文件。


How do I make

git status

ignore line ending differences?

Background info:

I use randomly Windows and Linux to work on the project. The project is in Dropbox.

I found a lot about how do make git diff ignore line endings. Since i use meld git diff opens meld for each file. And meld says "identical file".

So how do I avoid this. Git should only open meld for changed files. And git status should not report files as changed if only the file ending is different.

EDIT: Cause:

This happened because of this setting on Windows

core.autocrlf true

So I checked out the working copy on Linux and set core.autocrlf false on Windows.

It would be still nice to know how to make git status ignore different new lines.

解决方案

Use .gitattributes instead, with the following setting:

# Ignore all differences in line endings
*        -crlf

.gitattributes would be found in the same directory as your global .gitconfig. If .gitattributes doesn't exist, add it to that directory. After adding/changing .gitattributes you will have to do a hard reset of the repository in order to successfully apply the changes to existing files.

这篇关于Git状态忽略行结束符/相同的文件/窗口& linux环境/ dropbox / mled的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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