清除 Bitbucket 上的 git 存储库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13669410/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 15:00:51  来源:igfitidea点击:

Clear git repository on Bitbucket?

gitbitbucket

提问by MTCoster

I'm just getting started with git, and started messing about with Bitbucket. However, I now want to use the repository I created, but without its initial history.

我刚刚开始使用 git,并开始使用 Bitbucket。但是,我现在想使用我创建的存储库,但没有它的初始历史记录。

Is there any way I can clear out or purge my repository so that I can start from scratch?

有什么方法可以清除或清除我的存储库,以便我可以从头开始?

I'm not too bothered about any of the content, so can I just delete the repository, then create a new one with the same name?

我对任何内容都不太在意,所以我可以删除存储库,然后创建一个同名的新存储库吗?

回答by VonC

No need to delete it.

不需要删除它。

From your new local repo, simply:

从您的新本地存储库中,只需:

 git push --force -u origin master

That will replace the history of your BitBucket master branch by the new one you have done locally.

这将用您在本地完成的新分支替换您的 BitBucket 主分支的历史记录。

Now, if you had pushed other branches before, you might want to delete them.

现在,如果您之前推送过其他分支,您可能想要删除它们

git push origin :oldBranch