So I do have a habit of adding my own commands, simply as an alias, simply in the startup scripts of my *nix account and it works fine.
But apparently it also can be done inside git.
So in the example in [1], the new command is "git eradicate".
It was added to the ~/.git-config file as:
"-fdx" will also remove files that are mentioned in the .gitignore file.
As there are settings in there, this is perhaps not what you want.
According to the manual in [2] regarding git clean, the option "-x" has the following interesting effect:
"Don’t use the standard ignore rules (see gitignore[5]), but still use the ignore rules given with -e options from the command line. This allows removing all untracked files, including build products. This can be used (possibly in conjunction with git restore or git reset) to create a pristine working directory to test a clean build."
In that case, perhaps the one below is safer:
References
- [1] Medium.com - SE Radio, Git Eradicate, Progress On JMS
- https://medium.com/nipafx-news/jpms-support-for-module-versions-a-research-log-2c96f5d0c1ee
- [2] Git - --distributed-is-the-new-centralized - Git Clean
- https://git-scm.com/docs/git-clean
- explainshell.com
- https://explainshell.com/explain