Create GitLab merge request from cli

Do not push your branch before the following commands. If you push your branch before it will not work. Git response is going to be Everything up-to-date and the merge request will not be created.
  • Push my-branch to the remote repository and create a new merge request from our branch to the main branch of the project.
git push -o merge_request.create origin my-branch
  • Push my-branch to the remote repository and the target branch work with the merge request title <title> and a merge request description <description>, setting the merge request to remove the source branch when it’s merged:
git push \
	-o merge_request.create \
	-o merge_request.target=work \
	-o merge_request.title="<title>" \
	-o merge_request.description="<description>" \
	origin my-branch

References:

  • 1 GitLab Documentation
Previous
Next