无法结帐.gitattributes

时间:2015-12-23 16:58:34

标签: git gitattributes

我遇到了一个奇怪的问题,我无法从远程检出.gitattributes。最近添加了.gitattributes文件,我想将其拉入并进行一些更改。我做了git pull,它说我的分支是最新的,但文件没有出现在我的本地机器上(ls -al没有显示.gitattributes)。我试过git checkout origin .gitattributes,它说它与任何文件都不匹配。但是,如果我执行git rm .gitattributes,则git status会显示.gitattributes已暂存以进行删除。有谁知道如何解决这个问题?

编辑:

$ git status
On branch YansBranch
Your branch is up-to-date with 'origin/YansBranch'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
// some file changes due to auto converting crlf to lf

no changes added to commit (use "git add" and/or "git commit -a")

$ ls -al
total 5
drwxr-xr-x      Administ     4096 Dec 23 12:11 .
drwxr-xr-x      Administ        0 Aug  5 16:38 ..
drwxr-xr-x      Administ     4096 Dec 23 12:13 .git
-rw-r--r--      Administ      955 Dec 23 10:57 .gitignore
drwxr-xr-x      Administ        0 Aug  5 16:39 win

$ git rm .gitattributes
rm '.gitattributes'

$ git status
On branch YansBranch
Your branch is up-to-date with 'origin/YansBranch'.

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        deleted:    .gitattributes

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
// some file changes due to auto converting crlf to lf

这是我的.gitattributes

# THIS IS ONLY FOR THE gitattributes REPOSITORY.
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

#
# The above will handle all files NOT found below
#
# These files are text and should be normalized (Convert crlf => lf)
*.gitattributes text
.gitignore text
*.md text

# c++

#sources
*.C text
*.cc text
*.cxx text
*.cpp text
*.c++ text
*.hpp text
*.h text
*.h++ text
*.hh text

# Compiled Object files
*.slo binary
*.lo binary
*.o binary
*.obj binary

# Precompiled Headers
*.gch binary
*.pch binary

# Compiled Dynamic libraries
*.so binary
*.dylib binary
*.dll binary

# Compiled Static libraries
*.lai binary
*.la binary
*.a binary
*.lib binary

# Executables
*.exe binary
*.out binary
*.app binary

# c#
*.cs     diff=csharp

0 个答案:

没有答案