Cleaning up old remote git branches
Consider to run :
git fetch --prune
On a regular basis in each repo to remove local branches that have been tracking a remote branch that is deleted (no longer exists in remote GIT repo).
This can be further simplified by
git config remote.origin.prune true
this is a per-repo
setting that will make any future git fetch or git pull
to automatically prune.
To set this up for your user, you may also edit the global .gitconfig and add
[fetch]
prune = true
However, it's recommended that this is done using the following command:
git config --global fetch.prune true
or to apply it system wide (not just for the user)
git config --system fetch.prune true
First, what is the result of git branch -a
on machine B?
Second, you have already deleted heads/devel
on origin
, so that's why you can't delete it from machine B.
Try
git branch -r -d origin/devel
or
git remote prune origin
or
git fetch origin --prune
and feel free to add --dry-run
to the end of your git
statement to see the result of running it without actually running it.
Docs for git remote prune
and git branch
.