简体   繁体   中英

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

We are using Github, and its associated issue tracking system (ITS). We reference the issue id in the ITS in the commit message, linking the ITS and the commits. 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. Everything went smooth, and I force-pushed my changes to 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. 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. The commit that is referenced, however, does not show up in a normal 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.

Is there a way to trigger a complete new repository-read-in on Github, or can I somehow manually edit the linked commits? 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

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. It is my understanding that for performance reasons they do it less often than your local git does. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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