Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between git clean and system rm

Tags:

git

What is the difference between:

git clean -f temp1.txt

and

rm temp1.txt

Git doc says:

git-clean - Remove untracked files from the working tree

So what is really the point of doing this instead of only the system command?

like image 544
graph1ZzLle Avatar asked Jan 27 '13 16:01

graph1ZzLle


1 Answers

rm will delete the file no matter what. git-clean will only delete it if it's actually untracked. And of course git-clean also accepts arguments that customize its behavior in a repo-aware manner (e.g. -x).

like image 138
Jon Avatar answered Oct 20 '22 14:10

Jon