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 can use the git
command followed by rm
command , -r
flag and the name of your directory.
Example:
git rm -r myFolder
Now, we need to push our changes to the 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.