我想在一個大項目中只跟蹤某些 git中的目錄,其中大多數目錄將被排除,只有少數目錄會被跟蹤。所以,我想在我的.gitignore中使用非運算符,或者排除文件,ja?Git不會忽略目錄
這究竟是爲什麼:
% mkdir wtfgit
% cd wtfgit
% git init
Initialized empty Git repository in /home/foobar/wtfgit/.git/
% mkdir iwantthesefiles
% touch iwantthesefiles/foo
% mkdir idontwantthesefiles
% touch idontwantthesefiles/bar
% vim .gitignore
% cat .gitignore
*
!iwantthesefiles/
% git add --all
% git status
# On branch master
#
# Initial commit
#
nothing to commit (create/copy files and use "git add" to track)
的「不」語法能正常工作的最高目錄中的文件。
% touch baz
% vim .gitignore
% cat .gitignore
*
!iwantthesefiles/
!baz
% git add --all
% git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: baz
#
我該如何得到這個給我baz和foo作爲git跟蹤文件? (基本上,NOT-style globbing目錄是怎樣工作的?!好像不是這樣)!
謝謝!
對於我來說,我不得不添加兩行:!'腳本/'和'腳本/ *' – user151841 2015-09-30 14:31:40