Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ignore a global gitignore rule for specific repository

Tags:

git

I have a global .gitignore file at my home directory. For a certain repository, I want one ignore pattern specified in my global .gitignore to be ignored because files with that pattern are necessary to be tracked in this repository. Is this possible?

like image 204
Lahiru Chandima Avatar asked Oct 19 '25 13:10

Lahiru Chandima


1 Answers

In your local repository add a .gitignore file that negates the rule from your global .gitignore.

For example:

global .gitignore

*.foo

repos .gitignore

!*.foo

You are basically doing the same thing as this question. Just in two different files.

like image 61
Schleis Avatar answered Oct 21 '25 04:10

Schleis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!