Antje Janosch
Antje Janosch

Reputation: 1196

git - how to remove a directory

I have a clone of a remote repository. Now, I'd like to remove some directories from the projects (in my clone as well as in the remote repository). I simply don't know which steps to follow (I'm pretty new to git). I've tried to use

git rm -r path/to/my/directory

It deletes the directory locally but I don't know how to delete them on the origin...

The status display then:

On branch master
Changes to be committed:

(use "git reset HEAD <file>..." to unstage)

deleted:    path/to/my/directory/file1.txt
...

Can anybody help?

Upvotes: 0

Views: 507

Answers (2)

sehe
sehe

Reputation: 393134

I think the whole confusion is this:

Git is a stupid CONTENT tracker. A directory doesn't have content (it just contains the files) so it isn't tracked per se.

Once you commit the deletion, the directory will no longer appear in the git tree.

The paths technically only appear in 'git tree objects' which are, if you will, kind of an index sheet linking working tree paths to the git blobs (from the git object database)

Upvotes: 1

ThatGuyInIT
ThatGuyInIT

Reputation: 2239

You first need to commit your changes:

git add *
git commit -m "Deleted folder"

Then you just need to push your changes to your origin:

git push

Upvotes: 2

Related Questions