Tim Bezhashvyly Tim Bezhashvyly - 1 year ago 66
Git Question

How to include only selected files into git repository and exclude all the rest?

Is there any chance to do an opposite to what .gitignore file does? I mean include only specified files and exclude all the rest? Thank you in advance.

Answer Source

You can try the following:

#ignore everything
*

#except .c source
!*.c

(! negates the patterns specified in gitignore)