git - 永久删除提交

标签 git github git-rebase

我知道这个问题有成千上万个线程。

但是我发现了一件非常奇怪的事情。

如果您在 GitHub 上创建项目,请进行一些提交。
假设提交 1、2、3、4、5。
后来,您意识到您想要将某些内容更改为提交 3。

由于您在自己的分支机构工作,因此重写历史记录没有问题。

那么让我们这样做:(基于 this stackoverflow 答案)

git rebase --interactive 'bbc643cd^'

// Modify 'pick' to 'edit' into interactive prompt and :
git commit --all --amend --no-edit
git rebase --continue
git push -f

太棒了!错误已更正。 历史已被重写,因此提交 bbc643cd 现在是 lkqjfhchc
您可以在 GitHub 上查看源代码,所有内容都已更新。

但有人仍然可以在 GitHub 上找到它!

访问网址:https://github.com/your-nickname/your-project/commit/bbc643cd ...(完整的提交哈希)你会找到它的!

我们如何才能永久删除此提交?

感谢您的帮助!

最佳答案

我从这里联系了 Github 工作人员:https://github.com/contact

这是答案(我对此无能为力,没有修剪,没有 gc 等)

Hey Maxime,

The commit was available because commits are not automatically deleted when they're removed from the history of a branch -- they're deleted when they're garbage collected. I just ran garbage collection for that repository manually and the commit should now return a 404.

How often does the garbage collector run on your end?

GitHub 没有预定的垃圾收集过程。我们不 自动清除存储库缓存(我们在版本控制中 业务,所以除非绝对必要,否则我们不会删除数据😉)所以 通常,我们这样做的唯一原因是如果我们有人 writing in to us asking for us to clear them as part of the sensitive data removal process .

如果出现以下情况,我们也可能出于技术原因清除缓存 repo 协议(protocol)的内容或结构给我们带来了困难 托管它,但这通常只有在 repo 是 非常大或具有结构复杂的文件夹布局。

如果您对此有任何疑问或任何问题,请告诉我 否则。

希望这对您有所帮助。

干杯,XXXXX

所以你只需要等待或联系工作人员强制垃圾收集器,以防你遇到同样的问题!

关于git - 永久删除提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34582480/

相关文章:

git - 在 Git 中重新 merge merge 的树

windows - 不区分大小写的文件系统上的区分大小写的文件困扰着存储库

git - Git分支未显示所有分支

python - 用于从模板创建新的 GitHub 存储库的 Bash 脚本

git - 如何从重新建立分支的分支中重新建立分支?

git - 线性化 git 历史,保留所有提交

python - 如何交换生产和开发的配置文件?

git - 通过 git 删除一个 svn-Branch?

Git 在单个文件的历史记录中搜索字符串

api - Github 使用 2 因素身份验证创建 token