Jerzy Jamroz
Jerzy Jamroz

Reputation: 106

How to make one Gitlab repository to become a fork of another Gitlab repository if they are separated repositories (not forked)?

A GitHub repository was copied to GitLab. Next, the development was happening simultaneously on GitHub and GitLab over a few months. Then, the GitHub repository was finally moved to GitLab. Is there a way to assign the first GitLab repository to be the fork of the newly moved repository (which is the parent of the first one)? So that the "fork" indicator is active as on the picture: fork indicator.

Upvotes: 4

Views: 2720

Answers (1)

You're asking how to add a forked relation between existing repositories. GitLab provides an API to do this: Create a forked from/to relation between existing projects

POST /projects/:id/fork/:forked_from_id
Attribute Type Required Description
forked_from_id ID ☑ Yes The ID of the project that was forked from.
id integer/string ☑ Yes The ID or URL-encoded path of the project.

Upvotes: 5

Related Questions