1

I've a problem with a Gitlab self-hosted community edition. Recently I've rewrite history on a git repository, and that changed a lot of SHA-1 of commits. I've tried to place the "replace" references, but Gitlab still in Merge Request uses the old commit hashs. After some trials I've tried to export the project and check inside the exported files, and I noticed that Gitlab uses its database to hold the commit hash codes. Is there a safe way to change those commits? I'm the system administrator, so I have full access to gitlab instance and also root access to the machine hosting it.

Thank you all.

torek
  • 448,244
  • 59
  • 642
  • 775
Alby87
  • 171
  • 1
  • 10

2 Answers2

0

In short, no, there's not a way to change this for MRs.

The most you can do is remove the content of the commits from GitLab (the SHA and links will still appear in the MR UI, but they will result in a 404 error after they are removed). This will also remove the ability to see the diffs of these MRs.

To do this, follow the documentation described here for cleaning up repos after history rewrite. After using git filter-repo and uploading the commit map to GitLab, the old commits will be remapped to the new ones (removing all the old references) and the rewritten history will be removed forever.

sytech
  • 29,298
  • 3
  • 45
  • 86
0

I've had a success exporting the project, modifying the json file inside the tar gz changing the old commit/new commit, and importing the project. Yes, now the events are done by the importer (and no more the original committer/pusher), but this is accetable, as the story is now navigable in gitlab with the correct commit as company rules.

Alby87
  • 171
  • 1
  • 10