10

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?

ltdev
  • 4,037
  • 20
  • 69
  • 129

1 Answers1

15

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
Community
  • 1
  • 1
edi9999
  • 19,701
  • 13
  • 88
  • 127