How to delete all commits in Bitbucket [duplicate]

2019-04-14 23:43发布

This question already has an answer here:

I want to revert all my changes in a repository, so is it possible to delete all commits in Bitbucket? If so, how?

标签: git bitbucket
2条回答
做个烂人
2楼-- · 2019-04-14 23:57

I have no idea why you'd want to do something like this, but..

One way to do it would be to reset to your initial commit:

git reset --hard (find the sha1 of your first commit)

and then force push:

git push -f

You're pretty much rewriting the entire history of whatever branch you're pushing to. Why not just create a new repository?

查看更多
\"骚年 ilove
3楼-- · 2019-04-15 00:16
登录 后发表回答