Question

My organization made plenty of mistakes early on with git (storing binary objects, etc). We have re-done our .gitignore strategy to prevent binary objects (dll's, jars, zips) etc. from being committed.

What is the best way to identify files that are are currently version controlled, that would no longer be version controlled under the newly created .gitignore?

Was it helpful?

Solution

I would use ls-files:

git ls-files -i --exclude-standard

This shows committed files that would be ignored by standard git rules (i.e. according to .git/info/exclude, .gitignore in each directory, and the user’s global exclusion file).

If you want to test a particular ignore file, you can use the -X parameter to specify the file:

git ls-files -i -X .\.gitignore
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top