GIT stage and commit only files with specific file endings

I have tons of modified files and a good 2/3 of the files are images that I don't care about but still want to capture. For the rest, I need to monitor the changes very closely. To keep the files to a minimum, I need to look that I only want to create .png and .jpg and .gif files and capture them (cut out the background noise to look at the beef).

Having said that ...

How would you shoot and capture only files with these file endings without adding each file separately?

Edit:

Files changed

Directory structure is not flat

I am overwriting a WP theme which I configured very well and there is a security update I need to apply

+3


source to share


2 answers


Just

git add \*.jpg \*.png

      

This will add to your repository all tracked and modified files that match the wildcard



If your image files are the only things in a specific directory

git add <directory>

      

will add everything under this directory

+4


source


Ermmm ..., in case of flat directory structure

git add *.jpg *.gif *.png

      

Or, in a nested directory structure, the trick is to stop the shell from expanding the symbol *

and let git do it. Because git is recursive for subdirectories too.



git add \*.jpg \*.gif \*.png

      

Or am I missing something?

+1


source







All Articles