git 如何删除Bitbucket中的所有提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23185934/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to delete all commits in Bitbucket
提问by LazySloth13
I want to revert all my changes in a repository, so is it possible to delete all commits in Bitbucket? If so, how?
我想恢复存储库中的所有更改,那么是否可以删除 Bitbucket 中的所有提交?如果是这样,如何?
回答by yamafontes
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?
你几乎重写了你正在推动的任何分支的整个历史。为什么不创建一个新的存储库?
回答by sinhayash
git reset --hard <commit>
git reset --hard <commit>
Read more here: https://www.atlassian.com/git/tutorial/undoing-changes#!reset
在此处阅读更多信息:https: //www.atlassian.com/git/tutorial/undoing-changes#!reset