首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >.gitignore中的.DS_Store :不必要?

.gitignore中的.DS_Store :不必要?
EN

Stack Overflow用户
提问于 2012-06-12 08:10:51
回答 1查看 1.1K关注 0票数 0

我读到过有人将.DS_Store添加到他们的.gitignore文件中,但我使用Git1.7.6做了一个快速测试,我不确定这是否有必要。你认为如何?

代码语言:javascript
运行
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-06-12 11:00:44

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

这意味着git不会自动忽略这个文件(除非它在git的MacOS版本中打了特别的补丁,或者类似的奇怪的东西)。

可能它忽略它的原因可能是你的全局忽略了它。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10989060

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档