2014-01-09 150 views

回答

4

不幸的是,您需要在路徑中手動包含所有子目錄。這應該工作:

... 
sites/default/files/* 
!sites/default/files/Library/ 

sites/default/files/Library/* 
!sites/default/files/Library/bannerpt2.jpg 
... 
+0

工作就像一個魅力!謝謝! – Lumbee

3

您可以在排除的文件夾添加文件使用git add -f file

樣品的相互作用:

$ git init 
Initialized empty Git repository in /Users/killerx/temp/.git/ 
$ echo "*" > .gitignore 
$ touch a.txt 
$ git add a.txt 
The following paths are ignored by one of your .gitignore files: 
a.txt 
Use -f if you really want to add them. 
fatal: no files added 
$ git add -f a.txt 
$ git commit -m "t" 
[master (root-commit) db22f19] t 
1 file changed, 0 insertions(+), 0 deletions(-) 
create mode 100644 a.txt 
$ echo "a" > a.txt 
$ git status 
# On branch master 
# 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) 
# 
# modified: a.txt 
# 
no changes added to commit (use "git add" and/or "git commit -a") 
+0

但是,這只是一次'加'不?它沒有永久添加到回購協議中? – Lumbee

+0

當然,它是永久性的,如圖所示,如果您在更改列表中顯示提交後進行更改。 – KillerX

相關問題