我和我的同事们在git
使我们的Windows存储克隆上的某些文件正常运行时遇到了麻烦。克隆是通过克隆源自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
#
答案 0 :(得分:6)
GitHub guide所示的此设置存在的问题是自动转换是在存储库的结帐期间完成的。
这意味着您无需打开文件即可触发任何更改。
是否无法将autocrlf
设置为false,并在编辑器中打开那些能够尊重返回行字符的Windows文件?
注意(illustrated here),如果您需要转换,除了某些文件,您可以在父目录中添加.gitattributes,其中包含:
myFile -crlf
在文件中,您将属性设置为路径(或模式),或取消设置(带减号)。
crlf
属性是一个属性,用于指示文件是否受core.autocrlf
选项的影响。如果你取消它,Git不会搞乱文件中的行结尾
答案 1 :(得分:1)
要使用git 1.7.3.1在我的Windows 7机器上解决此问题,我必须将core.filemode选项设置为false。
git config -e --local