A few years ago I found that using git clean
with my MPS projects deleted too much. It deleted the MPS
workspace1, the .idea
directory that I would often have in my projects to facilitate remote debugging with
IntelliJ IDEA and some .properties
files that contained local settings but
were ignored by .gitignore
.
You can pass options to git clean
to exclude all of the above, but the command becomes cumbersome:
git clean -dx -e .idea -e .mps -e '*.properties' -e '*.log'
At some point I defined an alias for the above command:
alias mpsclean="git clean -dx -e .idea -e .mps -e '*.properties' -e '*.log'"
For safety reasons running the command above will not actually do anything as it’s missing a -f
or -n
flag that
would tell it to either delete the files (-f
) or do a dry run, listing all the files it is going to delete (-n
). The
flag needs to be provided explicitly. So I would use the alias like this:
mpsclean -n # do not delete anything yet
# check the list of files and directories to be deleted
mpsclean -f # actually delete the files
-
Newer MPS versions put a
.gitignore
file under the.mps
directory when creating a new project sogit clean
will no longer delete the MPS workspace by default. ↩︎