How to delete a remote branch using magit in emacs
Asked Answered
A

2

16

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.

Affricative answered 14/2, 2018 at 21:6 Comment(0)
B
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.

Bish answered 14/2, 2018 at 22:24 Comment(1)
Note that branch deletion is bound to magit-status,b,x (instead of k) in the current version of Magit.United
M
24

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.

Munday answered 15/2, 2018 at 0:54 Comment(4)
For me that was y rOrmond
For me, it was x rather than k.Levitt
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.Munday
those alternative keybindings are default when using evil and evil-collection packages, fwiw. See github.com/emacs-evil/evil-collection/blob/master/modes/magit/…Darcydarda
B
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.

Bish answered 14/2, 2018 at 22:24 Comment(1)
Note that branch deletion is bound to magit-status,b,x (instead of k) in the current version of Magit.United

© 2022 - 2024 — McMap. All rights reserved.