0

What I try to accomplish to merge changes of forked repo into main repo. Both repo’s master branch are protected. I can accomplish it via Gitlab web pages. But unfortunately, Gitlab rest api for merge request does not have source_project_id attribute.

Is there any way to create merge request via command line for forked repo into main repo ?

Gursel Koca
  • 20,940
  • 2
  • 24
  • 34

1 Answers1

1

When using the API, you would use the MR endpoint for the source project -- the fork that you created.

Suppose the "main" project is owner/main-project and your fork is user/main-project-fork

You would use the MR API endpoint (/projects/:id/merge_requests) using the id (or url-encoded path) of user/main-project-fork. Then you would provide the target_project_id parameter using the ID of the owner/main-project project.

sytech
  • 29,298
  • 3
  • 45
  • 86
  • thanks, documentation is not clear about that. How could you find solution, by trying.. – Gursel Koca Jul 26 '23 at 18:35
  • @GurselKoca I agree the docs could be made more clear. There is a small nuance in the documented URL `id` parameter: `The ID or URL-encoded path of the project owned by the authenticated user` -- that is to say, you certainly own your fork, but you may not necessarily own the upstream project. It can be ambiguous/confusing if you actually own both projects. – sytech Jul 26 '23 at 22:44