如何在保留差异能力的同时禁止Git搞乱线路结尾?

时间:2017-09-07 14:24:15

标签: git github

根据https://help.github.com/articles/dealing-with-line-endings/#per-repository-settings,我可以使用@Override protected Boolean doInBackground(Void... params) { // TODO: attempt authentication against a network service. Toast.makeText(getApplicationContext(),"Problem is in http", Toast.LENGTH_LONG).show(); String result; OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("http:192.168.0.102/db.php?username=tkajbaje@gmail.com&password=123456") .build(); Response response = null; try { response = client.newCall(request).execute(); } catch (IOException e) { e.printStackTrace(); } result=response.toString(); Toast.makeText(getApplicationContext(),result, Toast.LENGTH_LONG).show(); // TODO: register the new account here. return true; } 强制执行行结束处理政策。

我想告诉Git"不要触摸我的行结尾,我自己决定每个文件中每一行的结尾"。

我尝试关注.gitattributes文件:

.gitattributes

不幸的是,现在我无法再查看更改的差异(在Github for Windows中)。

无论文件类型如何,我怎能强迫“不要更改行结尾”#34;策略,同时保留查看文本文件的差异的能力?

2 个答案:

答案 0 :(得分:2)

如果这是整个回购的政策,为什么不只是git config core.autocrlf false

顺便说一句,如果您出于某种原因偏好属性,那么正确的属性就是-text。 (亚历杭德罗建议-crlf但这只是为了向后兼容。)

答案 1 :(得分:1)

请尝试使用此gitattributes文件:

# Ignore all differences in line endings
*        -crlf