Remove multiple deleted files in git

Sometimes when you are committing changes in git you’ll find that a number of files have been deleted.

You could manually set these files to delete by individually issuing the command:

git rm filename

However, there is a shortcut. If you issue the command:

git ls-files --deleted

It will return a list of all files that are flagged as deleted.

You can then simply pass that list to git rm, using a combined syntax like this:

git rm $(git ls-files --deleted)

Just don’t forget the--deleted parameter!




Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to send bulk emails using Spring Batch

Organizing code into modules with DCI (Data, Context, Interaction) architecture approach.

Elegant Python code reproduction of "most common words from a story"

Download In #PDF Exam Ref 70–765 Provisioning SQL

A cornerstone to understand container technology: cgroup

Stored procedure with output parameters

Terragrunt — Using credentials dynamically and Azure multi-subscription support

Azure AD Single-Sign-on with AWS SSO (With Guest User) — Invalid MFA credentials

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Praj Basnet

Praj Basnet

More from Medium

Git : Introduction

Git and GitHub.

Series Two: Git Essential Training: The Basics