+25
Completed

Add a "git clean" feature (remove untracked files)

ubruhin 7 years ago updated by Thomas Singer 6 years ago 8

Sometimes one want to clean up the working directory by removing all untracked files, which on the command line is done by the "git clean" command. It would be great to have this feature available in SmartGit.


The most important flags of the "git clean" command may be available as check boxes:

  • -d: Remove untracked directories
  • -x: Also remove ignored files
  • -X: Only remove ignored files

The -f flag (force) may automatically be used(?).


See also https://git-scm.com/docs/git-clean

seems like it's possible to do right now with a proper filtering options (in Files window), multiselection (Ctrl+A) and delete button

+1

That's true, but I see some advantages of a separate "git clean" feature in SmartGit:

  • "git clean" can also remove empty directories (I guess SmartGit only removes the selected files, but no directories).
  • Changing the filter options (two times) in the files view for a standard task is quite cumbersome.
  • A clean feature is less dangerous than manually changing the filter options each time (one small mistake and your local changes are lost forever).

Until implemented you may create your own external tool that performs the required "git clean" command.

+1

good point, I've done this - and it works just like the real thing. I'm leaving my upvote here not because I need this feature anymore, but because it could improve smartgit for other me's in future, to have it directly in the GUI

Often after checking out a divergent branch and rebuilding my project, I have to manually do git clean, then re-buildout the project. I would love an option for "clean on branch checkout" to prevent this minor irritation!

This could be dangerous if you are in the wrong branch and have already started with a new feature (e.g. created a new file) and then want to switch to the right branch for commit - bang, your changes are lost. I don't want the user to blame us for having added such a dangerous option.

So, you could add more value to SmartGit by implementing a Clean command as a special Stash containing all untracked/ignored files.


This would be great, and would reduce the risk to loose our work by executing ourselves a dangerous "git clean -fdx" command as I often do.