3

リモートから .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
4

0 に答える 0