Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gitignore - Ignore only images & ignore everything except .. in single command

Tags:

git

gitignore

How can I write to .gitignore:

  1. to ignore only images ( .jpg, .jpeg, .png, .gif )

  2. to ignore everything except videos ( .mp4, .flv etc )

using a single command each time?

like image 769
ltdev Avatar asked Aug 18 '15 11:08

ltdev


1 Answers

1 Ignore images

printf '*.jpg\n*.jpeg\n*.png\n*.gif\n' >> .gitignore

2 Ignore everything but videos:

See How do I tell Git to ignore everything except a subdirectory?

printf '*\n!*.mp4\n!*.flv\n' >> .gitignore
like image 51
edi9999 Avatar answered Oct 16 '22 22:10

edi9999