When git branch-r, I found that there are no branches in the remote.

I returned empty when I was in git branch-r. In other words, the system prompts me that I don"t have any branches remotely.
but I have two branches on github.
then I can"t delete my remote branch.
what"s going on? How to solve the problem?

clipboard.png

Jun.17,2022

git branch -a

you can view all branches, including local branches and remote branches

git branch -r -d origin/branch-name

Delete a remote branch

git checkout -b  origin/

pull the remote branch locally


git is the distributed design idea. Each git version library is independent of each other, and there is no notification mechanism by default. When any version library is updated, other people have no idea that git will not take the initiative to network to get updates-because Linus designed git to avoid criticism that SVN/CVS must be connected to the Internet before it can be used. After clone, everyone gets a complete copy of the version library, so even if the central warehouse is dead, you can find someone's version library and put it on it.

so the git synchronous version library must be operated manually, and the corresponding commands are fetch (local synchronization remote) and push (remote synchronization local).

so, if you want to see the remote branch, you must use git fetch to get the remote update and then look at it.

Don't be misled by the name of the origin/branch output by the branch command, which is actually a local branch and the data is stored in the local .git / directory. If you try to kill the remote branch, it must still be there.


first execute git pull to pull down this change of the created branch


first make sure that you are connected to the remote branch, otherwise you will not be able to pull all the branches no matter what you do.

Menu