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.

Example:

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.

Top Udemy Courses

JavaScript - The Complete Guide 2020 (Beginner + Advanced)
JavaScript - The Complete Guide 2020 (Beginner + Advanced)
45,614 students enrolled
52 hours of video content
View Course
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
284,472 students enrolled
40 hours of video content
View Course
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
Vue JS 2 - The Complete Guide (incl. Vue Router & Vuex)
130,921 students enrolled
21 hours of video content
View Course