github delete folder-How to remove a directory from git repository?


I have 2 directories on my GitHub repository. I'd like to delete one of them. How could I do that without deleting and re-creating the entire repository?



If you want to remove the directory from both git and local,

git rm -r directory-name

git commit . -m

git push origin <git-branch> 

If you want to remove the directory from git but not from the local file system,

git rm -r --cached myFolder


If you want to unleash your potential in this competitive field, please visit the DevOps course page for more information, where you can find the DevOps tutorials and DevOps frequently asked interview questions and answers as well.


This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.