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 ?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks, documentation is not clear about that. How could you find solution, by trying..
@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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.