Previous deploy previews getting overwritten by new PRs/MRs when switching Git providers

I had a site on Netlify with more than 50 deploy previews. The site was deploying from GitLab. I migrated the site from GitLab to GitHub, which migrated just the code and the branches. The pull requests on GitHub now started with #1, this started overriding my previous deploy previews that were created when I created a PR from GitLab.

Is there a way to avoid this?

hi parth, welcome back. which site is this concerning, please? :slight_smile:

Hi @parth0017, I don’t think there is any easy way to avoid that, since we use the information from the git provider to label your deploy previews. The most straight-forward solution to avoid this issue would be to link your migrated repository to a new netlify site and keep your old site linked to your Gitlab repo. Would that work for you?

1 Like

That wouldn’t work for me. Instead of using the PR number from git provider, would it be possible for netlify to maintain a count and simply increment it for deploy previews?

Hey @parth0017,
Unfortunately, we can’t simply use a counter because we use that deploy preview ID in many other places in our code. I’d echo Dennis’ suggestion to keep a GitLab archive site and start a new site with your GitHub PRs.

That said, I’m surprised that we’re overwriting your old previews. Could you please link to an example of a deploy preview where that happened? Maybe I could get an issue filed internally for that behavior.

Hello Jen, thanks for the clarification. I won’t be able to name/link the site here in public forum. I’d be able to do it in a private email. Let me know if that works.

Hey @parth0017, I did check and the behavior you’re seeing is intended since we do use your PR/merge request number to create the deploy preview link. Your best bet is still Dennis’s suggestion above or another (tedious) option would be to create a bunch of empty PR/merge requests until you reach the number you had on your GitLab repo. Probably not what you wanted to hear, but at least some clarity? Many thanks for your patience on this.

Haha, nice hack. Thanks for looking into this. For now I’ll hold back from moving the git provider.

1 Like