Last Updated on 2021-10-23 by Clay
After we pushing the project that we developed to GitHub repository, if we want to rename or remove a folder, we cannot rename and re-push. It will cause the old version folder still exist.
How to delete folder
If you want to remove the specific folder on GitHub, you need to use the following command via terminal:
git rm -r --cached FOLDER_NAME
git commit -m "YOUR_COMMENT"
git push -u origin main
The meanings of these steps as follow:
git rm -r --cached FOLDER_NAME
: Remove the specific name folder in cache.git commit -m "YOUR_COMMENT"
: Commit your comment message.git push -u origin main
: Push it again.
At this way, you can easily remove the specific name folder in GitHub repository.
References
- https://www.git-tower.com/learn/git/faq/github-delete-folder/
- https://github.community/t/how-to-delete-multiples-files-in-github/702/2