John Smith Optional
John Smith Optional

Reputation: 24836

How to untrack all deleted files in Git

What's the command to untrack all deleted files in Git?

I know there's a command to untrack a file by name (git rm myfile)

But I'd like to untrack all the deleted files, without caring about how they're named.

Upvotes: 16

Views: 15143

Answers (3)

125_m_125
125_m_125

Reputation: 618

In the newer versions of git, those files are automatically untracked with git add --update.

Upvotes: 31

Shunya
Shunya

Reputation: 2913

Have you checked the git clean command?

Upvotes: 1

Greg Bacon
Greg Bacon

Reputation: 139451

$ git diff-files --diff-filter=D --name-only -z | xargs -0 git rm

Upvotes: 2

Related Questions