

The command git branch -a shows remote branches that exist in your local repository. This may sound a bit confusing but to understand it, you have to understand that there is a difference between a remote branch, and a branch that exists in a remote repository. Remote branches are local branches that map to branches of the remote repository. So the set of remote branches represent the state of the remote repository.
The usual way to update the list of remote branches is to use git fetch. This automatically gets an updated list of branches from the remote and sets up remote branches in the local repository, also fetching any commit objects you may be missing.
However, by default, git fetch does not remove remote branches that no longer have a counterpart branch on the remote. In order to do that, you explicitly need to prune the list of remote branches:
git fetch --prune
This will automatically get rid of remote branches that no longer exist on the remote. Afterwards, git branch -r will show you an updated list of branches that really exist on the remote: And those you can delete using git push.
That being said, in order to use git push --delete, you need to specify the name of the branch on the remote repository; not the name of your remote branch. So to delete the branch test (represented by your remote branch origin/test), you would use git push origin --delete test.
Git says remote ref does not exist when I delete remote branch
I ran git branch -a * master remotes/origin/test remotes/origin/master I want to delete my remote branch I've tried git push origin --delete remotes/origin/test I got error: unable to
stackoverflow.com
'DEVELOPMENT > Git' 카테고리의 다른 글
[Git] Github에 잔디가 심어지지 않을때 (0) | 2020.07.14 |
---|---|
[Git] What is detached HEAD state and how do I get out of it? (0) | 2020.01.25 |
[Git] commit message 바꾸기 (0) | 2020.01.25 |
[Git] commit message로 issue 정리하기 (0) | 2020.01.08 |
[Git] Github 간편 사용 설명서 (0) | 2020.01.04 |