Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a remote branch using magit in emacs

Tags:

git

emacs

magit

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.

like image 885
Arthur Ulfeldt Avatar asked Feb 14 '18 21:02

Arthur Ulfeldt


People also ask

How do I delete a remote branch?

To delete a remote branch, you can't use the git branch command. Instead, use the git push command with --delete flag, followed by the name of the branch you want to delete. You also need to specify the remote name ( origin in this case) after git push .

What is the command to delete a branch in your remote repository?

Deleting a branch REMOTELY Here's the command to delete a branch remotely: git push <remote> --delete <branch> . The branch is now deleted remotely.

How do I delete a remote branch in stash?

Delete branches We can delete a branch by calling the branch command and passing in the -d option, followed by the branch name.


2 Answers

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.

like image 62
phils Avatar answered Oct 10 '22 04:10

phils


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.

like image 38
tanzoniteblack Avatar answered Oct 10 '22 03:10

tanzoniteblack