Git FAQ

Frequently asked questions around Git and Version Control.

How to Delete Files and Folders on GitHub

The web interface on GitHub.com allows you to do basic editing tasks. You can delete a specific file after opening its detail view and then clicking on the little trash can icon:

However, you cannot delete multiple files in one go nor can you delete folders in the GitHub web interface.

These tasks must be performed in a local repository, after cloning it to your computer. For an in-depth tutorial on how to clone and work with a local repository, take a look at our free online book on learning Git.

How to Delete Files and Folders in a Local Git Repository

If you're using Git in a desktop GUI like the Tower Git client, you can simply select one or more items - both files and folders - and delete them:

In case you're using Git on the command line, you can use the following commands:

# To delete a file:
$ git rm my-file.txt

# To delete a folder, add the '-r' option:
$ git rm -r my-folder

After deleting the file or folder, don't forget to commit the deletion to record it in the repository.

The Git Cheat Sheet

No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!


Learn More

About Us

As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.

Just like with Tower, our mission with this platform is to help people become better professionals.

That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.