How to remove folder from Git after .gitignore

June 08, 2020 by Andrew Kirchofer

Have you added a folder to .gitignore but it's already been committed and pushed to GitHub?

First, navigate to the your project directory. Then run each of the lines below in your command line environment:

git rm -r --cached folder_to_remove
git commit -m 'REMOVED: Previously committed folder'
git push origin master

Replace folder_to_remove with the folder you're looking to remove.

URL Monitoring

Our robots monitor your endpoints for downtime – so you don't have to. Your first monitored URL is free!

Get Started for Free

Get started today, no credit card required.