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

后端 未结 1 927
心在旅途
心在旅途 2021-02-05 23:51

How can I write to .gitignore:

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

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

相关标签:
1条回答
  • 2021-02-06 00:09

    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
    
    0 讨论(0)
提交回复
热议问题