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

How can I write to .gitignore:

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

  2. How to undo a git pull?
  3. Reuse Git submodule's submodule
  4. How do I force git to prompt for credentials?
  5. Why do I have to “git push --set-upstream origin <branch>”?
  6. See treeview for branches in Atlassian Stash
  7. Cascaded git repositories, SoCs Linux kernel
  8. to ignore everything except videos ( .mp4, .flv etc )

using a single command each time?

  • Squash to only one “proper” commit for github pull request
  • How to rebase commits from another repository with a different history?
  • Does a git commit hash equal a repository state?
  • What files of my project should I put in repo
  • How to see git diff from very beginning to the HEAD?
  • Git post-receive hook not running following push
  • One Solution collect form web for “Gitignore – Ignore only images & ignore everything except .. in single command”

    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
    Git Baby is a git and github fan, let's start git clone.