How can I write to .gitignore:
to ignore only images ( .jpg, .jpeg, .png, .gif )
to ignore everything except videos ( .mp4, .flv etc )
printf '*.jpg\n*.jpeg\n*.png\n*.gif\n' >> .gitignore
See How do I tell Git to ignore everything except a subdirectory?
printf '*\n!*.mp4\n!*.flv\n' >> .gitignore