Blue Ice
Blue Ice

Reputation: 7930

How to un-ignore/override all files from the global .gitignore?

After looking at git ignore exception, I realized that one can ignore files in a repository from a global .gitignore file.

Is there any way that you can override all rules from the global .gitignore file, so that the repository will have everything in it and nothing ignored? (besides un-ignoring every file individually)

Upvotes: 19

Views: 6630

Answers (2)

Blue Ice
Blue Ice

Reputation: 7930

Create a .gitignore in the repo folder with one rule:

!*

This forgets the rules (with !) of all of the files (*) in the main .gitignore.

Upvotes: 40

Valeri Atamaniouk
Valeri Atamaniouk

Reputation: 5163

You can.

Create you own .gitignore file with appropriate rules and put into directory in where it shall apply. The rules will be applicable for a directory with local .gitignore and its subdirs.

Upvotes: 2

Related Questions