pkj
pkj

Reputation: 781

Add files to Git except some given file type

I suspect that this is a duplicate and should be easy, but I could not figure it out.

Suppose this is my folder structure

 - Parent folder
    - Folder1
    - Folder2
    - .git

Now I want to add all files in Folder2 except some file type say .xls, something of this sort

git add 'C:\Parent folder\Folder2' <except .xls>

Also let me know if I want to add a specific file type.

Thanks :)

Upvotes: 0

Views: 151

Answers (1)

Haemin Yoo
Haemin Yoo

Reputation: 541

You can put a .gitignore file at the desired subdirectory. It will apply recursively to all subdirectories of that directory.

Github maintains a collection of .gitignore templates. You may find it convenient to use.

Here is a relevant question: Correctly ignore all files recursively under a specific folder except for a specific file type

And another one you might find useful: How to remove files that are listed in the .gitignore but still on the repository?

Upvotes: 1

Related Questions