The difference between git clean and system rm

What's the difference between:

git clean -f temp1.txt

and

rm temp1.txt

Git doc says:

git-clean - delete unprocessed files from the working tree

So what really needs to be done instead of just a system command?

+5
source share
3 answers

rmwill delete the file no matter what. git-cleandelete it only if it is not actually verified. And, of course, git-cleanalso accepts arguments that adjust its behavior based on the repo (for example, -x).

+7
source

? . git clean , , , , . , , , .

+5

A great advantage git cleanarises when specifying a path or path that applies to multiple files. If you just start git clean -xdf, you basically restore the working directory to its original state without any unplayed files. For example, if you ignored the binaries, you can use them to delete them all at once, without having to specify each folder manually.

+4
source

All Articles