Branches that are deleted upstream can't be deleted locally.
In our company the master
branch is protected and every contribution must be done to a temporary branch and go through a merge request and review before it is integrated. This results in a lot of temporary branches that get deleted on the server when they are merged. However those branches are not deleted locally, and I haven't found a clean way to delete them:
- For an obsolete branch
foo
, I can delete thefoo
bookmark but not thedefault/foo
"tag" that corresponds to the upstream branch. - If I strip the local branch, it gets recreated the next time I pull even though it no longer exists on the server! I assume it was kept in the local git cache?
- The only way I've found to get rid of the deleted branches is to either run
hg gclear
orrm .hg/git/refs/heads/* .hg/git/refs/remotes/default/*
, then the nextpull
restores only the branches that still exist upstream and I can strip the stale branches.
Note that developpers who use git directly have no problem because git pull
only fetches the current branch, whereas hg pull
fetches all existing branches (see also #357). So they don't see the branches from other's merge requests.