开发者

git - how to remove a directory

开发者 https://www.devze.com 2023-03-16 01:24 出处:网络
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 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 r开发者_运维百科m -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?


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


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消