admalledd
admalledd

Reputation: 438

have a new .gitignore tell me if any file already matches tracked files

is there a way to parse a .gitignore and tell me if i already have some files that match the ignores so that i know to remove them or change my .gitignore?

example is that i have git tracking my imgs directory, and i wish to ignore all of windows Thumbs.db, and also tell me if I have any left over in my repository being tracked so that i can remove them.

Upvotes: 3

Views: 214

Answers (1)

Ben Jackson
Ben Jackson

Reputation: 93720

Try git ls-files --ignored. You might have to play with the options, but ls-files is the right starting point for writing a script that matches files using the excludes patterns.

Upvotes: 3

Related Questions