Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

gitignore

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.

like image 521
user487772 Avatar asked Jul 26 '11 09:07

user487772


1 Answers

You can try the following:

#ignore everything
*

#except .c source
!*.c

(! negates the patterns specified in gitignore)

like image 80
CharlesB Avatar answered Sep 27 '22 19:09

CharlesB