Magne
Magne

Reputation: 17223

How to pull a branch deletion in git?

If someone has deleted the remote branch, is there any way I can pull from the same repository, and get my local branch deleted as well?

It would be handy not to have all developers do the manual removal of a branch when we're done with a feature.

Upvotes: 6

Views: 453

Answers (2)

blahdiblah
blahdiblah

Reputation: 33991

No, though you might be looking for git remote prune.

In the case of truly local branches (not just remote refs), it would be non-trivial to push deletes. The branch would have to be up to date, and pulling isn't much more work than deleting it. How would stashes on that branch be handled? While not necessarily unsolvable, it's not currently supported.

Upvotes: 1

manojlds
manojlds

Reputation: 301147

Only thing you can do is:

git remote prune origin

And you can't delete the local branches, which have to be manually deleted.

Upvotes: 5

Related Questions