2014-01-09 170 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

相关问题