Reputation: 17512
How do you delete a remotes/origin/{branch}?
Upvotes: 51
Views: 16575
Reputation: 63
git branch -r -d origin/branch-name
worked for me when the remote branch was already deleted (so git push origin --delete <branch-name>
wasn't possible) and git prune origin
wasn't doing anything (for a reason I don't yet understand)
Upvotes: 6
Reputation: 161
Let's say you've fetched a branch like so:
git fetch origin MT-2766
To remove the corresponding remote-tracking branch run:
git branch -r -d origin/MT-2766
Upvotes: 14
Reputation: 1465
use: git remote prune origin
or use git remote prune origin --dry-run
to preview what branches will be removed.
As in git help remote
prune
Deletes all stale remote-tracking branches under . These stale branches have already been removed from the remote repository referenced by , but are still locally available in "remotes/".
With --dry-run option, report what branches will be pruned, but do not actually prune them.
Upvotes: 65
Reputation: 25029
git push origin :[branch-name]
.
Source: http://progit.org/book/ch3-5.html
Upvotes: 3