Delete remote git branch
Sometimes when you work in command someone can delete remote branch. And when you enter in your terminal some command like
git branch -a
you can see branches, which was already deleted.
The fact that refs/remotes/origin/feature/somebranch exists in your local repository does not imply refs/heads/feature/somebranch exists in the origin remote repository
For example you want delete some of this branch
git push origin :feature/some_branch
And get
error: unable to delete 'feature/some_branch': remote ref does not exist
error: failed to push some refs to 'git@github:someone/somewhere.git'
In this cases you need to do
git fetch -p origin
to make refs/remotes/origin/feature/some_branch go away if it's already deleted in origin. The -p option tells fetch to delete any tracking branches that no longer exist in the corresponding remotes; by default they are kept around. You get:
x [deleted] (none) -> origin/feature/some_branch