如何删除Github网络视图中显示的git中的未命名分支 [英] How to remove unnamed branch in git shown in Github network view

查看:224
本文介绍了如何删除Github网络视图中显示的git中的未命名分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的git仓库的Github网络视图中,有一个没有名字的幻影分支。请看下面的图片。



为简单起见,我想删除黑色分支(仅留下蓝色分支)。



如何做到这一点?






解决方案

假设黑色分支从Commit A开始,到Commit Z结束.A和Z都是蓝色圆点。在cmd中,A和Z是commit sha1。

  git rebase --onto Z ^ 2 A master 

这是一个线性历史记录。但是,如果这样做,您必须 git push origin -f master:master 来强制更新远程主服务器并通知每个成员获取并跟踪新主服务器并放弃旧服务器一个。

In the Github's network view of my git repository, there is a "phantom" branch that has no name. Please see the picture below.

For the sake of simplicity I would like to remove the black branch (leaving only the blue branch).

How can this be done?

Some of the labels with the hash:

解决方案

Assume the black branch starts at Commit A, and ends at Commit Z. Both A and Z are the blue dots. In the cmd, A and Z are the commit sha1.

git rebase --onto Z^2 A master

This makes a linear history. But if doing so, you must git push origin -f master:master to update the remote master by force and inform every member to fetch and track the new master and abandon the old one.

这篇关于如何删除Github网络视图中显示的git中的未命名分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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