71

Last week I upgraded my Windows Github to Github Desktop.

It is certainly a lot faster than that last update they made for Github Windows. It also has a nice little visual timeline of commits and maybe I am being dumb, but the ability to delete local branches seems to be gone.

Before it was under “manage branches” (also gone). Any idea?

Update:

In v3.0.5 they have added the option to delete local branches from the gear menu. enter image description here

Bruffstar
  • 1,249
  • 1
  • 10
  • 18

8 Answers8

38

On Mac OSX:

for everyone having this problem with the latest version: Select the branch that you want to delete, go to "Branch" -> "Delete Branch"

Github Desktop (Mac OSX)

On Windows:

Github Desktop (Windows)

Kevin Crain
  • 1,905
  • 1
  • 19
  • 28
ProblemsOfSumit
  • 19,543
  • 9
  • 50
  • 61
22

Here's the answer I got from github CS when I contacted them about this:

Thu 2015-08-13 3:38 PM Hi Daniel, Sorry about that! We'll be adding the option to delete branches back in an upcoming release. For now however, here's how you can delete a branch from the Git Shell: Hit ~ in GitHub Desktop to open up the repository in the Git Shell Run 'git branch -d branch_name' When you create a new branch you should see an option to publish it directly in the comparison graph. Let me know if that doesn't make sense or if you have more questions - thanks and sorry for the inconvenience! Robert

I've noticed there is a delay (about 2 or 3 minutes) between deleting the local branch in the shell and git desktop realizing the change.

UPDATE

In 3.0.5 They added Delete the current branch from the gear menu.

danielml01
  • 441
  • 2
  • 10
  • Hi Daniel, thank you for your reply. I have been using Git Shell to delete branches and I have not had any delay on Github Desktop when the branch is deleted, strange. Nice to see that they have this fix in an upcoming release. – Bruffstar Sep 02 '15 at 15:19
  • @ danielml01 looks like the delete current branch has been added only for Windows version? – klode Sep 11 '15 at 21:38
  • 1
    @klode, I thought so as well, but you can find it under the "Branch" menu on the Mac client. – Brent Sep 22 '15 at 18:43
14

In GitHub Desktop, you can delete the current branch here:

enter image description here

With the following dialog allowing you to delete it from remote as well:

enter image description here

Stefan Collier
  • 4,314
  • 2
  • 23
  • 33
  • "Branch" -> "Delete..." is disabled in version 1.2.2? – CoderDave Jun 04 '18 at 20:37
  • 1
    (After seeing this) I just updated to 1.2.2, created a local branch then deleted that local branch with no issue. Could you post this as a new SO issue with images of the issue and we can debug it? – Stefan Collier Jun 05 '18 at 10:35
10

In desktop, make sure you are in the correct branch, and press "ctr+shift+D".This should delete the branch, this method works in windows; I cant confirm for other Linux/Mac.

Liam Crowley
  • 101
  • 1
  • 5
  • Welcome to StackOverflow, add some more description and code if it's required to understand the answer because it will resolve someone else problem ASAP – Nensi Kasundra May 13 '20 at 04:49
5

I personally confirmed that, on the new version, advanced branch management has been removed, and you can only delete branches from the website.

As a personal recommendation, you should give Atlassian SourceTree a try. Works like a charm, it's free (requires a free registration), and even when it's originally developed to work with Atlassian's BitBucket repositories, it also works well with GitHub.

And BTW, with SourceTree, you can remove GitHub branches :)

Hope it helps!

Cristian Meneses
  • 4,013
  • 17
  • 32
  • 2
    If I delete a branch from the website... then, locally, it just says "publish" again, seems to be really no option to delete it, except from the command line. btw +1 for Source Tree, I have used it before, it is fantastic. – Bruffstar Aug 19 '15 at 22:18
  • plus 1 for source tree.. that just solved my issue. it does let you do it - yep – timothy Sep 01 '15 at 16:39
3

Sometimes I have a strange behaviour with GitHub Desktop: when I delete a branch in GitHub Shell, the branch continues to shown into the drop-down menù of GitHub Desktop! ... same behaviour with the "Delete branch-name..." function of GitHub Desktop.

I solved with git show-refto list all refs

cf7c75b18e47a566f5bebccd3746f19fa426af4f refs/heads/master
cf7c75b18e47a566f5bebccd3746f19fa426af4f refs/remotes/origin/HEAD
540b3c8032f76ec13c84d6f40de885b996465dcb refs/remotes/origin/branch1
cf7c75b18e47a566f5bebccd3746f19fa426af4f refs/remotes/origin/branch2

when there are the ref to remote, GitHub Desktop can't delete at all the branch.

You can't remove a ref with git update-ref -d refs/remotes/origin/branch* and then you have

cf7c75b18e47a566f5bebccd3746f19fa426af4f refs/heads/master
cf7c75b18e47a566f5bebccd3746f19fa426af4f refs/remotes/origin/HEAD

Now you can remove the branc with git branch -d branch*

1

2021-July-28 Update

I'm pleased to see now that in Github Desktop (at least on Mac) you can not only right+click a branch name and choose delete from the list of branches,

enter image description here

but, you can also choose to delete the branch on the remote as well in the confirmation dialogue. Naturally you'll want to confirm that's the action you wish before doing so.

enter image description here

Original Command Line Instructions

I know this is a question about the GUI, but until the feature arrives, as a user of Github Desktop I find it easier to jump into the command line ctl + ^ and use the following. If you have a lot to delete it is easier than switching to each branch...

git branch -d <branch_name>
ow3n
  • 5,974
  • 4
  • 53
  • 51
0

Right Click on branch which you want to delete it will show 3 options in that you have to click on delete.

enter image description here

Or if you want to delete current branch then select -> delete option from branch dropdown.

enter image description here

enter image description here

Ankur prajapati
  • 485
  • 6
  • 9