6

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.

Magne
  • 16,401
  • 10
  • 68
  • 88
  • Wouldn't you need to restore it? http://stackoverflow.com/questions/1992364/git-recover-deleted-remote-branch – TryTryAgain Mar 21 '12 at 19:27
  • There's another solution to this problem. Stop cluttering the main repo with feature branches :) – rtn Mar 21 '12 at 20:31

2 Answers2

5

Only thing you can do is:

git remote prune origin

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

manojlds
  • 290,304
  • 63
  • 469
  • 417
1

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.

blahdiblah
  • 33,069
  • 21
  • 98
  • 152
  • The stashes don't belong to any branch (in fact they form the reflog of a pseudo branch). Therefore, obviously, deleting branches never deletes the stashes (unless you explicitely request deletion of refs/stash pseudo branch itself – sehe Mar 21 '12 at 19:42