删除提交为好 [英] Remove commit for good

查看:97
本文介绍了删除提交为好的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题有数千个线程。



但是我发现了一些很奇怪的东西。



如果你在GitHub上创建一个项目,做一些提交。

假设提交1,2,3,4,5。

稍后,你意识到你想改变一些东西进入提交3。



当你在你自己的分支工作时,重写历史没有问题。



所以让我们这样做:(基于这个 stackoverflow答案)

  git rebase --interactive'bbc643cd ^'

//将'pick'修改为'编辑'到交互式提示符中:
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,

提交可用,因为提交不是当他们从分支的历史中删除时自动删除
- 当他们被垃圾收集时,他们被删除
。我只是手动为该
储存库运行垃圾收集,现在提交应该返回一个404。



希望这有助于。



干杯,XXXXX


因此,您只需等待或联系员工即可强制垃圾收集器同样的问题!


I know there are thousands of threads for this question.

But I found out something really weird.

If you create a project on GitHub, do some commits.
Let's say commit 1, 2, 3, 4, 5.
Later, you realize you want to change something into commit 3.

As you were working in your own branch, no problem to rewrite history.

So let's do this: (based on this stackoverflow answer)

git rebase --interactive 'bbc643cd^'

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

Great! The mistake is corrected. The history has been rewritten, so the commit bbc643cd is now lkqjfhchc.
You can check the source on your GitHub and everything will have been updated.

But someone can still find it on GitHub!

Access the URL: https://github.com/your-nickname/your-project/commit/bbc643cd... (full commit hash) and you will find it!

How could we remove this commit for good?

Thanks for any help!

解决方案

I contacted Github staff from here : https://github.com/contact

Here's the answer (I couldn't do anything about it, no prune, no gc, etc)

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.

Hope this helps.

Cheers, XXXXX

So you just have to wait or contact staff to force garbage collector in case you have the same problem !

这篇关于删除提交为好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆