git – How do I remove a tag about a remote branch?

Question:

There is a remote GIT repository (original). There is local storage (Z) without working files. Two branches have been saved to local storage Z branch1 and branch2.

Created two working folders for the repository.
From one we ran the command to delete a remote branch:

$ git push Z --delete branch1

Now, if we display a list of remote branches in the second working folder, we will see the label branch1:

$ git branch --remote  
z/branch1  
z/branch2  
origin/HEAD -> origin/master  

If we try to execute the command to delete the branch branch1 from the second folder, we will receive an error message:

$ git push Z --delete branch1
error: unable to delete 'branch1': remote ref does not exist
error: failed to push some refs to 'Z:\GitRepositories\Storage1'

How to remove information about the remote branch branch1 from the second working folder?

Answer:

try updating remote Z with the –prune option in the second copy. this should remove information about branches that no longer exist:

$ git remote update Z --prune
Scroll to Top