By default, git fetch gets an updated list of remote branches from the remote and sets up remote branch references locally. However, it doesn’t delete stale references that no longer have a counterpart on the remote. Trying to get rid of these using the git push -f origin:branch-name command will fail with a remote ref does not exist error.

To delete stale remote references, you need to pass the --prune option to fetch like so:

git fetch --prune
- [deleted]  (none) -> origin/branch-name