Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

When I perform branch -a:

$ git branch -a
* master
 remotes/origin/HEAD -> origin/master
 remotes/origin/hello
 remotes/origin/master

And then I remove the branch:

$ git branch -r -D origin/hello
Deleted remote branch origin/hello (was c0cbfd0).

Now I see:

$ git branch -a
* master
 remotes/origin/HEAD -> origin/master
 remotes/origin/master

The branch "hello" has been removed. But when I fetch:

$ git fetch
From localhost:project
 * [new hello]      hello     -> origin/hello

$ git branch -a
* master
 remotes/origin/HEAD -> origin/master
 remotes/origin/hello
 remotes/origin/master

I'm so confused.
I think it has been removed, but it is still there.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

You need to remove it from the remote with the following command:

git push origin --delete hello

When you are running git branch -rd origin/hello you are deleting your local branch only. The code above removes it from the origin repo.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...