14

what is the magit key sequence which is the equivalent of

git push origin :branch-to-be-deleted

that will cause the branch to be dropped from the remote repo.

Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284

2 Answers2

23

You can type y (magit-show-refs) to go to the refs buffer, and then k (magit-branch-delete) on any remote branch to delete it.

Mark
  • 215
  • 1
  • 7
phils
  • 71,335
  • 11
  • 153
  • 198
  • 1
    For me that was `y r` – ibizaman Apr 29 '19 at 18:09
  • For me, it was `x` rather than `k`. – Mark May 14 '20 at 10:11
  • 4
    I'll just note that neither `x` nor `r` are standard Magit key bindings for this. By default `x` is for resetting, and `r` is for rebasing, and `k` is for discarding or deleting. Anything different is due to your own config. Thanks for adding the command names to the answer, @Mark. – phils May 14 '20 at 10:15
  • 1
    those alternative keybindings are default when using evil and evil-collection packages, fwiw. See https://github.com/emacs-evil/evil-collection/blob/master/modes/magit/evil-collection-magit.el – hraban Aug 30 '21 at 23:38
15

The built in branch delete feature of magit (magit-status, b k; or directly call the function magit-branch-delete) will delete remote branches in addition to local branches. Instead of specifying my-branch as the branch to delete, make sure to specify my-remote/my-branch.

tanzoniteblack
  • 664
  • 4
  • 5
  • 1
    Note that branch deletion is bound to `magit-status`,`b`,`x` (instead of `k`) in the current version of Magit. – scetoaux Apr 27 '19 at 10:33