Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"git clean -xdf" with some additional filter

Tags:

git

Is it possible to do git clean -xdf with some additional filter? What I want to do is delete all untracked files but keep files with a certain file extension.

like image 357
Carl-Otto Kjellkvist Avatar asked Apr 24 '13 19:04

Carl-Otto Kjellkvist


1 Answers

Use the -e option to specify an exclude pattern.

Example: This deletes all untracked files except those with the .txt extension:

git clean -xdfe *.txt
like image 61
Klas Mellbourn Avatar answered Oct 22 '22 03:10

Klas Mellbourn