2014-10-11 120 views
0

帶DS_Store的Bitbucket .gitignore也會忽略封閉的目錄以及該目錄中的所有其他文件。 假設我在.gitignore中有.DS_Store。 我更改並添加文件到目錄。 由於.DS_Store文件已創建,因此將忽略整個目錄和其他文件。 我想提交我的其他更改,但bitbucket忽略它們!bitbucket .gitignore .DS_Store也會忽略封閉的目錄

如何配置這樣.DS_Store文件不在我的bitbucket?

+0

你的問題的措詞聽起來像Git是忽略所有的包含.DS_Store的任何目錄的內容,除非該目錄是名爲.DS_Store的目錄的子目錄,否則該內容將不真實。也許你可以分享你的.gitignore內容和目錄結構? – CodingWithSpike 2014-10-11 02:01:46

+0

「你的問題的措辭聽起來像git忽略了任何包含.DS_Store的目錄中的所有內容」。這是完全正在發生的事情。 .gitignore中唯一的條目是.DS_Store – hogsolo 2014-10-13 21:47:13

+0

你可以發佈.gitignore文件,也許可以解釋你的目錄和文件格式嗎?這不是Git應該如何工作的,所以我懷疑你的情況有些奇怪。 – CodingWithSpike 2014-10-14 11:41:13

回答

0

如果您包含.gitignore文件以及要添加的文件,它將會有所幫助。

取決於你想完成以下任一項應該工作。

如果你要的文件仍然忽略,但它們添加任何方式再使用-f選項(-f/- 力 允許添加,否則忽略的文件),以git add

git add -f <some_file> 

如果你想爲了管理他們,那麼你需要重新配置你的.gitignore。一種方式可能看起來像

.gitignore 
.DS_Store 
!.DS_Store/file_to_be_added 

通過搜索SO可以找到各種特定的.gitignores和howtos的示例。

0

(這是不是一個真正的答案,但希望空間來放置代碼)

對於理智的緣故,嘗試在控制檯/殼新/空目錄這樣做:

git init 
touch .DS_Store 
touch otherFile.txt 
echo .DS_Store> .gitignore 
git add .gitignore 
git status 

結果應該是:

On branch master 

Initial commit 

Changes to be committed: 
    (use "git rm --cached <file>..." to unstage) 

     new file: .gitignore 

Untracked files: 
    (use "git add <file>..." to include in what will be committed) 

     otherFile.txt