How do I delete a local branch on Github Desktop?

柔情痞子 提交于 2019-12-02 19:56:10
ProblemsOfSumit

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"

On Windows:

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.

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!

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

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

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*

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!