Headless
Headless

Reputation: 253

Can I do git-clean with libgit2?

I want to remove untracked files from the working tree. Like here https://www.kernel.org/pub/software/scm/git/docs/git-clean.html

Upvotes: 6

Views: 1226

Answers (1)

Carlos Martín Nieto
Carlos Martín Nieto

Reputation: 5277

libgit2 doesn't implement this itself. It's a porcelain command, which deals with interaction with the user. It also deals primarily with files which are of no interest to the Git repository.

You can run status to see which files are untracked and then remove whichever ones the version of git-clean would have removed through the usual means available in your programming language.

Upvotes: 6

Related Questions