Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in DevOps and Agile by (29.3k points)

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?

1 Answer

0 votes
by (50.2k points)

To remove a directory from git and local can be done using 

git rm -r directory-name

git commit -m "Remove duplicated directory"

git push origin <your-git-branch> (In most cases it will be master but not in all cases).

You may also look for deleting the directory from git but not from the local file system. For that use

git rm -r --cached myFolder

This will remove the directory from git but not from the local file system.

Reference: https://git-scm.com/docs/git-rm#Documentation/git-rm.txt--r

Browse Categories

...