9

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!

SuperUser
  • 157
  • 1
  • 7
  • As far as I know, this is a feature. It’s so that when someone makes commits for specific issues (e.g. in a pull request) and those original commits are later removed, then you can still look at them from the issue themselves. I don’t think there’s a way to remove those references, but you might want to contact GitHub support about this. – poke Feb 24 '14 at 09:54
  • 3
    I've confirmed with GitHub staff via email that it is still not possible to remove these references. The support staff has passed it along as a feature request, though, so *just maybe*. – Sean Allred Oct 01 '17 at 18:15
  • 1
    See also https://github.com/isaacs/github/issues/1081, created for tracking. – Sean Allred Oct 01 '17 at 18:48
  • The hard way is to create a new repo and push the cleaned-up repo to it. There are tools to recreate issues if needed, but you'll end up with ned IDs for pull requests and issues. – jessehouwing Feb 19 '21 at 09:46

1 Answers1

0

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.

Andrew Aylett
  • 39,182
  • 5
  • 68
  • 95