Vorrei solo monitorare certe directory in git in un progetto più grande, in cui la maggior parte delle directory verrà esclusa e solo poche verranno tracciate. Quindi, volevo usare i non-operatori nel mio file .gitignore o escludi, ja?Git non ignorerà una directory
perché sta succedendo questo:
% 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)
Il "non" la sintassi funziona bene per i file nella directory più alta.
% 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
#
Come posso ottenere questo per darmi baz e foo come file git tracciati? (In sostanza, come funziona la directory NOT-style globbing funziona a tutti ?! Sembra non farlo.)
Grazie!
Per quanto mi riguarda, ho dovuto aggiungere due linee:!! 'Script /' e 'script/*' – user151841