-1

Remove files incompatible with the current .gitignore

David Rodrigues 1 month ago • updated 1 month ago 2

If you create a file like "abc.txt", commit it, then create a gitignore to ignore that file, this file will keep being part of the repository. So a solution like "removed ignored files" should be great.


It could be done automatically, like an suggestion to user just remove a new ignored file from repository, or as a tool option (via menu).


It basically do that:


git rm -r --cached . 
git add .


https://stackoverflow.com/a/19095988/755393

You may try following in SmartGit:

  • show files recursively
  • remove all tracked files but keep them physically available
  • commit them
  • add all "untracked" files
  • amend-commit them

Now the latest commit should only contain files that were considered ignored. Alternatively, you may create a tiny script that invokes your above mentioned commands and add that to the Tools section in the preferences.

+1

The git command seems be more pratical hehe. But I mean, it could be available directly from Smartgit, without need do all manually (for both: run commands or then your method). It will help with repository cleanup.