How to remove the first commit in git?

后端 未结 9 1764
深忆病人
深忆病人 2020-12-07 07:20

I am curious about how to remove the first commit in git.

What is the revision before committing any thing? Does this revision have a name or tag?

9条回答
  •  渐次进展
    2020-12-07 07:26

    Another way you can do is:

    1. Checkout to a branch you want to keep (say dev) git checkout dev
    2. Now, delete the branch you want to reset git branch -D master
    3. Now, create an empty branch with the same name git checkout --orphan master

    Ofcourse, all of this would depend on your usecase, but if you have more than one branch, deleting the .git directory does not make sense.

提交回复
热议问题