Victor
Victor

Reputation: 23932

How to remove unnamed branch in git shown in Github network view

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?

left side right side

Some of the labels with the hash:

One commit One commit One commit

Upvotes: 3

Views: 1036

Answers (1)

ElpieKay
ElpieKay

Reputation: 30878

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.

Upvotes: 2

Related Questions