简体   繁体   English

在重写历史记录后,Github的问题跟踪器中对旧提交的引用仍然存在

[英]Reference to old commit in Github's issue tracker persits after rewriting history

We are using Github, and its associated issue tracking system (ITS). 我们正在使用Github及其相关的问题跟踪系统(ITS)。 We reference the issue id in the ITS in the commit message, linking the ITS and the commits. 我们在提交消息中引用ITS中的问题ID,链接ITS和提交。 Since I had confused many issue ids in the commit messages of commits that were already pushed, I had to "rewrite history" in my Git repository. 由于我已经在已经推送的提交的提交消息中混淆了许多问题ID,因此我不得不在我的Git存储库中“重写历史记录”。 Everything went smooth, and I force-pushed my changes to Github. 一切顺利,我强行推动我对Github的改变。

I was hoping that the links from the issue in the ITS to the old commits (which are not visible with git log anymore) would be updated, and changed to the new commits that reference them. 我希望能够更新从ITS中的问题到旧提交(用git log不再可见)的链接,并更改为引用它们的新提交。 Unfortunately, they were not. 不幸的是,他们不是。 Even though the commit from the issue does not exist anymore in the repository, it is still referenced from the issue's website on Github. 即使问题的提交在存储库中不再存在,仍然会从Github上的问题网站引用它。 The commit that is referenced, however, does not show up in a normal git log . 但是,引用的提交不会显示在普通的git log I am a bit puzzled as to the fact that I can, in fact, git checkout <old_commit> , even though there is no evidence of this commit having ever existed in the log. 事实上,我可以git checkout <old_commit> ,尽管没有证据证明这个提交曾经存在于日志中,但我感到有点困惑。

Is there a way to trigger a complete new repository-read-in on Github, or can I somehow manually edit the linked commits? 有没有办法在Github上触发一个完整的新存储库读入,或者我可以以某种方式手动编辑链接的提交? Additionally, there is no link to the new commits from the issue. 此外,该问题没有与新提交的链接。

I found a related help page from Github, but that only suggested to me that from the git push onwards, Github would handle everything itself: https://help.github.com/articles/can-i-delete-a-commit-message 我从Github找到了一个相关的帮助页面,但这只是向我建议,从git push开始,Github将自己处理所有事情: https//help.github.com/articles/can-i-delete-a-commit-信息

Thank you! 谢谢!

Even if the commit does not exist in your local clone, and there is no tags or branches refering to it, the commit may still exist in the repository on Github if Github has not yet run the garbage collector on it. 即使您的本地克隆中不存在提交,并且没有引用它的标记或分支,如果Github尚未在其上运行垃圾收集器,则提交可能仍存在于Github上的存储库中。 It is my understanding that for performance reasons they do it less often than your local git does. 据我所知,出于性能原因,他们比你当地的git更少。 If so it will eventually go away. 如果是这样,它最终会消失。

I do not know if "having a pointer from the issue tracker" counts as a reason that the commit cannot be garbage collected. 我不知道“有一个来自问题跟踪器的指针”是一个原因,提交不能被垃圾收集。 If so, it will not be as long as the issue exists. 如果是这样,只要问题存在就不会存在。

GitLab has a backup feature which exports the entire project and all associated data. GitLab有一个备份功能,可以导出整个项目和所有相关数据。 The easiest way I've found to completely remove a commit from a project is to take a backup, do the manual editing to the repository and data contained within, then restore -- first test by restoring to a new repository, then delete the old repository and restore in its place. 我发现从项目中完全删除提交的最简单方法是进行备份,手动编辑到存储库和其中包含的数据,然后还原 - 首先通过还原到新存储库进行测试,然后删除旧的存储库并在其位置恢复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM