【问题标题】:How to delete all commits in Bitbucket [duplicate]如何删除 Bitbucket 中的所有提交 [重复]
【发布时间】:2014-04-21 02:19:30
【问题描述】:

我想恢复存储库中的所有更改,那么是否可以删除 Bitbucket 中的所有提交?如果有,怎么做?

【问题讨论】:

  • 创建一个新的 repo(如果不需要,丢弃旧的)。这还不够吗?

标签: git bitbucket


【解决方案1】:

我不知道你为什么要做这样的事情,但是..

一种方法是重置为您的初始提交:

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

然后强制推送:

git push -f

你几乎重写了你所推动的任何分支的整个历史。为什么不直接创建一个新的存储库?

【讨论】:

  • 如果你的初始提交是 3GB 的,那么你的壁橱里仍然有那个怪物,这不会删除它。
【解决方案2】:

git reset --hard <commit>

在这里阅读更多: https://www.atlassian.com/git/tutorial/undoing-changes#!reset

【讨论】:

    猜你喜欢
    • 2019-02-05
    • 2018-11-14
    • 2012-12-12
    • 2016-06-29
    • 2021-03-15
    • 2012-11-22
    • 1970-01-01
    • 2013-01-28
    相关资源
    最近更新 更多