Juraj
Juraj

Reputation: 1

Git: how to remove root commit


I have following situation in my local Git repository:
master: A---B---C <-HEAD
(no name): D

so there is special commit "D" on separate branch, not relating on any other branch. I want to delete the "(no name)" branch. When trying to revert "D", I get: "Cannot revert a root commit".

Thank you for help.

Upvotes: 0

Views: 651

Answers (2)

Carl
Carl

Reputation: 44488

What Casey said. Run "git gc" and see if it still exists. The other thing you might want to try is create a new branch at D and then remove the branch with git -D

Upvotes: 0

cmcginty
cmcginty

Reputation: 117096

If there is no branch that reference D, then git will remove the reference when you do a garbage collection.

Upvotes: 1

Related Questions