简体   繁体   中英

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.

如果没有分支引用D,则git在进行垃圾回收时会删除该引用。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM