git - Make .gitignore tout sauf quelques fichiers

Mots clés : gitgitignoregit

meilleur 5 Réponses git - Make .gitignore tout sauf quelques fichiers

vote vote

96

# Ignore everything *  # But not these files... !.gitignore !script.pl !template.latex # etc...  # ...even if they are in subdirectories !*/  # if the files to be tracked are in subdirectories !*/a/b/file1.txt !*/a/b/c/* 
vote vote

85

pippo/* !pippo/pluto pippo/pluto/* !pippo/pluto/paperino.xml 
pippo/* !pippo/pluto/paperino.xml 
vote vote

76

# Blacklist files/folders in same directory as the .gitignore file /*  # Whitelist some files !.gitignore !README.md  # Ignore all files named .DS_Store or ending with .log **/.DS_Store **.log  # Whitelist folder/a/b1/ and folder/a/b2/ # trailing "/" is optional for folders, may match file though. # "/" is NOT optional when followed by a * !folder/ folder/* !folder/a/ folder/a/* !folder/a/b1/ !folder/a/b2/ !folder/a/file.txt  # Adding to the above, this also works... !/folder/a/deeply /folder/a/deeply/* !/folder/a/deeply/nested /folder/a/deeply/nested/* !/folder/a/deeply/nested/subfolder 
vote vote

60

webroot/cache* !webroot/cache/.htaccess 
webroot/cache/* !webroot/cache/.htaccess 
vote vote

59

# ignore these * # except foo !foo 

Questions similaires