Reputation: 8098
I had a folder on github, say folder
which I renamed to folder1
a few commits ago. I now see that both folder
and folder1
show up in my repository. How can I remove the old folder. I have tried git rm and git mv but they don't work because folder
doesn't exist in my directory tree anymore.
Upvotes: 1
Views: 1376
Reputation: 68810
You should use git mv
to rename folders:
git mv <old> <new>
It will rename your folder, remove the old name from your repository, and add the new one. You also can use this bunch of commands:
mv <old> <new>
git add <new>
git rm <old>
If you want to remove a whole directory that has already been pushed, use this:
git rm -r <old>
git commit -m "Remove unused directory"
git push origin master
Upvotes: 6
Reputation: 1133
You can try this: git rm -rf directory_name
It will force delete the directory.
Upvotes: 2