I have a branch called dev
which is up-to-date with the origin/dev
. I want to merge into the (protected) master
with the following command, but it doesn't push either create the merge request.
$ git push -o merge_request.create -o merge_request.target=master
Everything up-to-date
How to create a merge request from an already pushed commit from CLI?
This solution is based on this, but mine is more general. The solution below creates a custom-named branch to push it, and it requests the delete of the newly created branch on merge.
# Create new unique merge-request branch ex: 1234abc-to-master
git checkout -b `git rev-parse --short HEAD`"-to-master"
# Create merge request with upstream this new branch
git push -u origin `git rev-parse --abbrev-ref HEAD` -o merge_request.create -o merge_request.target=master -o merge_request.remove_source_branch