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. editing commits with git rebase
  3. Git/source tree move specific commits at branch B to branch A
  4. Porting a fork of a software to a new version
  5. Git diff of a branch, excluding commits in other branch
  6. Summary of changes between two commits of branches in Git
  7. git non-fast-forward error
  8. to ignore everything except videos ( .mp4, .flv etc )

using a single command each time?

  • Git subtree not properly using .gitignore when doing a partial clone
  • How and why does “git checkout HEAD” result in different results for “--theirs” and “--ours”?
  • git stash and pop shows file no longer marked as moved?
  • Jenkins and Stash setup ssh key
  • Git compare before Merging 2 branches
  • Git Merge without removing the other branch to pull the changes
  • 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.