Not just the command, but the actual behavior... hg purge will delete all untracked files.
I thought it was git clean, but nope...
$ git clean
fatal: clean.requireForce defaults to true and neither -n nor -f given; refusing to clean
$ git clean -n
Would not remove src/
$ git clean -f
Not removing src/
So, it feels like git just told me to go f*** myself, lol... I'm not asking this thing if it agrees, I just want Git to do what I ask of it.
How do I convince Mr. Git to please do me the favor of removing my untracked files?
2. 27. hg purge --all will delete all un-tracked and ignored files. This is useful for cleaning up in-source builds. – tacaswell.
git clean removes untracked files from the working directory. It does not remove files that have been committed. To do that you would use git rm . So if your git repo is at the root of your hard drive, then running git clean -df would remove all the files from your disk that aren't committed.
If you want to also remove directories, run git clean -f -d
If you just want to remove ignored files, run git clean -f -X
If you want to remove ignored as well as non-ignored files, run git clean -f -x
Note the case difference on the X for the two latter commands.
EDIT: useful linkie bout this git operation :)
Here is a quick translation:
hg purge
translates to git clean -f -d
(deletes only untracked files and directories)hg purge --all
translates to git clean -f -d -x
(also deleted ignored files)Git also has git clean -f -X
(upper case X) which only deletes ignored files but leaves untracked files untouched. Mercurial has no equivalent for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With