Pruning branches that were deleted in upstream Git repo but still exist in my fork

bitbucket, git

Solution

If you want to remove the branches on the remote use this command:

git remote prune fork_origin

But before that, take a look at this thread and see what can go wrong: git remote prune – didn't show as many pruned branches as I expected

Problem

I created a fork of a git repo on BitBucket (let's call it `fork_origin`). Now the upstream repository (let's call it `upstream_origin`) has had numerous branches merged into it's master and deleted. So running ``` git fetch --prune upstream_origin ``` deleted lots of `remote/upstream_origin/` branches, but now those same branches still exist in the `remote/fork_origin/` namespace. Is there a standard git command to deal with this? I'd like to stay away from complex bash scripts that do mass deletes on the remote repos. UPDATE: As suggested, I tried to use the remote prune command: ``` git remote prune fork_origin ``` However, it had no effect. Upon further investigation, that seems to work only for 'stale' branches, but when I run: ``` git remote show fork_origin ``` it shows that all of the branches are still 'tracked'. So it makes sense that the `git remote prune` command had nothing stale to delete. Is there a way to force the remote repo (`fork_origin`) to update it's branch statuses relative to `upstream_origin`?

Original source

Related problems