How to delete a branch in the remote repository using EGIT?

EclipseGitBranchEgit

Eclipse Problem Overview


How to delete the remote branch itself in sourceforge with all files in it, using egit ?

Eclipse Solutions


Solution 1 - Eclipse

Go to Team > Remote > Push… from the menu. Select your repository, and click Next. Under Remote ref to delete… select your branch and click Add spec. Then click Finish. This should delete the remote branch.

how-to-delete-remote-branch-in-eclipse-egit

Solution 2 - Eclipse

(Update March 2012)

As tukushan mentions in the comment:

> In Egit 1.3.0, this only deletes the remote tracking branch in the local repository, not the remote branch.

As Michael Mior details in his (upvoted) answer, you need to push "nothing" to the remote branch : git push origin :branch, which from git1.7+ is better coded as git push origin --delete branch.

With Egit, see "Delete Ref Specifications section":

Remote ref to delete in Egit


(Original answer December 2011)

You can also check out the very latest release of EGit (1.2, released yesterday December 23rd, 2011). You now have another way to delete a remote

From its EGit/New and Noteworthy/1.2:

> In the commit graph area, there is a new context menu action "Delete Branch" allowing to delete a branch.
It will be enabled if a branch exists for the currently selected commit, which is not checked out.
If there is a single branch on this commit, which is not checked out, this action will delete this branch immediately.
If multiple such branches exist, a dialog will be shown asking which branches should be deleted.
If commits become unreachable on "Delete Branch" a confirmation dialog will be shown to prevent accidental unreachability of commits.

It remains to be tested if that option can delete a branch for a commit on a remote namespace (a commit part of a remote repo and fetched in your local repo).

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionIsmail MarmoushView Question on Stackoverflow
Solution 1 - EclipseMichael MiorView Answer on Stackoverflow
Solution 2 - EclipseVonCView Answer on Stackoverflow