by Sai gowtham

How to delete directory/folder from a Git repository

In this tutorial, we are going to learn about how to delete a directory or folder from a remote and local git repository.

Deleting directory in Git

To delete a directory from git repository we need to use the git command followed by rm command , -r flag and name of your directory.


git rm -r myFolder

Now we need to use push our changes to remote git repository by using the below commands.

git commit -m 'myFolder is deleted'
git push

Now our directory is removed both locally and remotely from Git.