我讀過關於將.DS_Store添加到.gitignore文件中的人,但我使用Git 1.7.6做了一個快速測試,我不確定這甚至是必需的。你怎麼看?.gitignore中的.DS_Store:不必要?
[email protected]:~$ mkdir test
[email protected]:~$ cd test/
[email protected]:~/test$ git init
Initialized empty Git repository in /Users/johndoe/test/.git/
[email protected]:~/test$ touch foo.txt
[email protected]:~/test$ touch .DS_Store
[email protected]:~/test$ touch bar.txt
[email protected]:~/test$ touch .DS_Store2
[email protected]:~/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)
[email protected]:~/test$ git config -l
user.name=John Doe
[email protected]
color.ui=true
core.editor=mate -w
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
什麼是.DS_Store2參考?如果它是一個項目類型,你可以考慮爲它添加一個額外的標籤。 – 2012-06-12 00:14:31
只需將.DS_Store添加到您的全局gitignore文件中,這樣您就不需要混淆各個存儲庫。如果您使用Emacs或Vi,則同樣適用於*〜,#*#。 –
@Michael我只是說明我沒有什麼時髦的東西,那是隱藏來自Git的隱藏文件。我想我可以使用「.hidden」而不是「.DS_Store2」。 – Nick