Git分支在本地回购合并,但仍在Github上可见 [英] Git branch merged on local repo but still visible on Github

查看:163
本文介绍了Git分支在本地回购合并,但仍在Github上可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的项目使用 Git Flow ,并且已完成将我的特性分支合并到我的 develop 分支中的 git flow特性完成步骤。



然后我执行了 git push 到GitHub,但是在GitHub上我仍然看到了特性分支以及 develop



当我在本地运行 git branch 时,我只看到开发 master ,这正是我期望的。



我从GitHub中移除分支?我可以应付这个问题,但是如果每个功能都发生这种情况,我最终会得到一大堆旧分支。



非常感谢。

解决方案假设 origin remote引用您的GitHub存储库,您可以删除合并的分支:

  git push origin:现在合并分支的名称



为了进一步解释语法,当你这样做时:

  git push origin some-branch 

... some-分支参数实际上是一个 refspec ,它定义源名称和目标名称之间的映射,通常采用格式< source-name>:< destination-name> 。如果在refspec中没有,它假定你的意思是 some-branch:some-branch 。说我只想删除远程分支的方式是完全错过< source-name> ,最后只是以后跟远程分支名称。


I'm using Git Flow for my project, and have completed the git flow feature finish step that merged my feature branch into my develop branch.

I then performed git push to GitHub, but on GitHub I still see the feature branch as well as develop.

When I run git branch locally, I only see develop and master, which is what I'd expect.

How can I remove the branch from GitHub? I could cope with this one, but if this happens for every feature I'll end up with a massive list of old branches.

Many thanks in advance.

解决方案

Assuming the origin remote refers to your GitHub respository, you can delete the merged branch with:

git push origin :name-of-now-merged-branch

To explain that syntax further, when you do:

git push origin some-branch

... the some-branch parameter is actually a "refspec" which defines a mapping between a source name and a destination name, usually of the form <source-name>:<destination-name>. If there's no : in the refspec, it assumes that you mean some-branch:some-branch. The way to say "I just want to delete the remote branch" is to miss out the <source-name> completely, just ending up with : followed by the remote branch name.

这篇关于Git分支在本地回购合并,但仍在Github上可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆