0

I've read about people adding .DS_Store to their .gitignore files, but I did a quick test using Git 1.7.6 and I'm not sure it's even necessary. What do you think?

johndoe@John-Does-MacBook-Pro:~$ mkdir test
johndoe@John-Does-MacBook-Pro:~$ cd test/
johndoe@John-Does-MacBook-Pro:~/test$ git init
Initialized empty Git repository in /Users/johndoe/test/.git/
johndoe@John-Does-MacBook-Pro:~/test$ touch foo.txt
johndoe@John-Does-MacBook-Pro:~/test$ touch .DS_Store
johndoe@John-Does-MacBook-Pro:~/test$ touch bar.txt
johndoe@John-Does-MacBook-Pro:~/test$ touch .DS_Store2
johndoe@John-Does-MacBook-Pro:~/test$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .DS_Store2
#   bar.txt
#   foo.txt
nothing added to commit but untracked files present (use "git add" to track)
johndoe@John-Does-MacBook-Pro:~/test$ git config -l
user.name=John Doe
user.email=johndoe@example.com
color.ui=true
core.editor=mate -w
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
4

1 回答 1

2

我对 git 的整个源代码进行了递归 grep,除了 git-gui 目录的 .gitignore 之外,没有看到对“.DS_Store”的任何引用。

这意味着 git 不会自动忽略该文件(除非它在 ​​git 的 MacOS 版本中进行了特殊修补或类似的奇怪东西)。

可能它为您忽略它的原因可能是您在全局忽略中拥有它。

于 2012-06-12T03:00:44.183 回答