jkp*_*jkp 5 windows git line-endings
我和我的同事git在使用我们的Windows repostiory克隆上的某些文件时遇到了很大的麻烦.克隆是通过克隆源自OSX机器的存储库而制作的.我们已经将autocrlf设置为true,但问题是我们会定期查找git认为已更改的文件,即使我们从未触摸它们(我们甚至不在编辑器中打开它们).
以下输出说明了问题:我出错的任何想法?
$ git status
# On branch master
# Your branch is behind 'origin/master' by 27 commits, and can be fast-forwarded.
#
# 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: Web Applications/webclient/language/en/lang_copyitems.ini
#
no changes added to commit (use "git add" and/or "git commit -a")
Administrator@windows-dev ~/Documents/Workspace/prestige.git
$ git diff "Web Applications/webclient/language/en/lang_copyitems.ini"
diff --git a/Web Applications/webclient/language/en/lang_copyitems.ini b/Web Applications/webclient/language/
index 800c188..ed11c0e 100644
--- a/Web Applications/webclient/language/en/lang_copyitems.ini
+++ b/Web Applications/webclient/language/en/lang_copyitems.ini
@@ -1,12 +1,12 @@
-<EF><BB><BF> [Header]
- Description=Language strings for 'copyitems.php'
-
- [Messages]
- 300=Copy
- 301=Close
- 302=COPY STORIES
- 303=Name
- 304=In Queue
- 305=New Name
- 306=Items to Copy
- 308=This item has mandatory metadata fields that are not correctly set. Click any part of this messag
+<EF><BB><BF> [Header]
+ Description=Language strings for 'copyitems.php'
+
+ [Messages]
+ 300=Copy
+ 301=Close
+ 302=COPY STORIES
+ 303=Name
+ 304=In Queue
+ 305=New Name
+ 306=Items to Copy
+ 308=This item has mandatory metadata fields that are not correctly set. Click any part of this messag
Administrator@windows-dev ~/Documents/Workspace/prestige.git
$ git checkout HEAD "Web Applications/webclient/language/en/lang_copyitems.ini"
Administrator@windows-dev ~/Documents/Workspace/prestige.git
$ git status
# On branch master
# Your branch is behind 'origin/master' by 27 commits, and can be fast-forwarded.
#
# 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: Web Applications/webclient/language/en/lang_copyitems.ini
#
Run Code Online (Sandbox Code Playgroud)
如GitHub指南所示,此设置的问题是在检出存储库期间自动转换...
这意味着您无需打开文件即可触发任何更改.
是不是可以保持autocrlf虚假,并在编辑器中打开那些能够尊重返回行字符的Windows文件?
注意(此处说明),如果您需要转换,除了某些文件,您可以在父目录中添加.gitattributes,其中包含:
myFile -crlf
Run Code Online (Sandbox Code Playgroud)
在文件中,您将属性设置为路径(或模式),或取消设置它们(使用减号).
该crlf属性是一个属性,用于指示文件是否受core.autocrlf选项影响.如果你取消它,Git不会弄乱文件中的行结尾
| 归档时间: |
|
| 查看次数: |
5884 次 |
| 最近记录: |