To make question more specific, I'll have example.
I've cloned a project from github. Then I've made some commits and pushed it.
At this moment, if I type git branch
& git branch -r
command, I can get list of local branches and remote branches.
git branch
git branch -r
Now, if I want to remove remote branch, git push origin search -d
will help.
git push origin search -d
git branch -r
Great. It works well.
However, If I remove this branch through the github, the problem occurs.
Since my local does not know that remote branch is removed, it still retrieves origin/search
when I type git branch -r
command. So I tried to use command git push origin search -d
to remove origin/search
from my local. However, it threw error like below
(Sorry for Korean, It means
error: failed to push some refs to 'https://github.com/njh7799/test
)
HaHa. Git cannot remove the remote branch because it does not exists!
Eventually, origin/search
lives forever in my local when I type git branch -r
. The question is, how can I delete it?