How to handle a bunch of deleted files under Git?

I have deleted about 20 files from my project. How to commit them with one command instead of git rm <filename> them one by one?

  • In git, editing a historical pre-pull commit after the pull causes divergence from origin
  • Git “server”, manage access via SSH keys
  • How to recover last commit after git hard reset?
  • What are the differences between `--squash` and `--no-ff --no-commit`?
  • What to commit after a git pull?
  • Gitlab upgrade error init.d directory or file issue
  • Vim fugitive plugin does not recognise git archive on Windows
  • ls output colors for specific files?
  • Git hook when a new branch is created and/or pushed
  • How to list committed git files per size?
  • Versioning image sprites in a git repository
  • Find commit with the smallest diff
  • 2 Solutions collect form web for “How to handle a bunch of deleted files under Git?”

    If you don’t want to commit all other changes in your working directory at the same time (as git add -A would do), you can use

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

    git add -A will add all changes, including deletions, to the index. Then commit away.

    Git Baby is a git and github fan, let's start git clone.