Jimmy
Jimmy

Reputation: 10341

How to remove deleted folder from remote repository in Git?

i deleted a folder from my local Git repository then i committed and pushed the changes to the remote repository, the files are deleted but the folder and the sub folder are still there. How could i remove the empty folder from the remote repository?

Upvotes: 14

Views: 19115

Answers (2)

brycemcd
brycemcd

Reputation: 4513

You can force git to quit tracking a local file by calling:

git rm file.txt #warning, this also deletes the file from your filesystem

You can delete an entire directory (and it's contents) by calling:

git rm -rf directory

Upvotes: 22

Ben Jackson
Ben Jackson

Reputation: 93720

Git doesn't actually store directories. It just makes directories wherever it needs them to hold the files that are in the repository. If a new clone still creates those directories, make sure you don't have files you can't see (like .gitignore) present.

Upvotes: 6

Related Questions