开发者

Git: how to remove root commit

开发者 https://www.devze.com 2023-03-07 12:08 出处:网络
开发者_Go百科 I have following situation in my local Git repository: master: A---B---C <-HEAD (no name): D
开发者_Go百科

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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消