Is there an automatic way to deduplicate .gitignore rules?

Is there any tool or web service that accepts a .gitignore file, somehow checks the rules and notifies of duplicate rules (i.e., match matches)?

I have a long Git repository that has been initialized with several default .gitignore templates , which have been manually changed in a few months. After removing some of the obvious duplication of rules, such as test-A.mdand test-*hand, I began to wonder.

So far I have found methods for clearing the text of repeated phrases, but nothing that could actively evaluate the rules of ignoring. The answer may be useful for Syncthing and BitTorrent Sync users trying to clear up the confusing .syncignore rules. Thanks!

+4
source share
2 answers

There is no automatic tool at my disposal. But you can use git-check-ignore for each rule through the command line.

Example:

git check-ignore -v filename

From the documentation

, --stdin, , .gitignore ( ) , .

, ; . '-no-index.

+2

.gitignore, .gitconfig .

[core]
   excludesfile = /Users/your_user_name/.gitignore_global
+1

Source: https://habr.com/ru/post/1605730/


All Articles