Can I merge merge requests myself?
git - Avoid push --force when updating a gitlab merge request - Stack Overflow
Force Launch pipeline from Merge button on MR page
Merge request fast-forward if possible
I don't know why I can't find anything on this topic, perhaps the question is just plain stupid.
I have to follow a certain workflow which in this case does not allow me to rebase nor merge one feature branch into another.
If I wasn't using GitLab I would simply create the necessary changes to resolve the conflict myself, merge, then solve the conflict using whatever was necessary to do so, thus creating a merge commit which explains the necessary changes to incorporate feature-a into branch-b.
How can I do this using GitLab though? All merge commits are created by GitLab, never myself. All branches except my own branches are protected. GitLab only tells me to "resolve locally" with a guide that simply seems to imply rebase is going to solve my problems (it won't), providing no further guidance.
Can I just merge locally, then push and GitLab will know my merge commit is in reference to the merge request? Will it allow my push because the merge request has been approved?
If so, do I have to add the references like "See merge request !123 for ..." to the merge commit description myself?
Force push is a valid workflow in this case. It is not that dangerous, because the old version of the branch is still available locally via git reflog and on the server all the versions you pushed are also saved in gitlab (see https://docs.gitlab.com/ee/user/project/merge_requests/versions.html).
You can push modifications happening during the review in new commits and once the branch is ready to be merged use gitlab's squash commits functionality if you really want to avoid force pushing, but this offers less flexibility than using interactive rebase with force push, because it means that the whole branch will be turned into a single commit before being merged.
You do not need to force push to update a merge request, unless the change rewrites history.
For example, if you have an existing merge request with changes to my_branch and you want to make another change, you can do the following after making the changes to one or more files:
# In case newer changes have been made on the remote/GitLab
git pull origin my_branch
git add .
git commit -m 'Additional changes'
git push origin my_branch
The above does not require a force push because it has not rewritten the history. However, if you rewrite history such as through a rebase, a force push is required:
git add .
git commit -m 'Additional changes'
git rebase -i master
git push origin my_branch --force
The other scenario that could require a force push that doesn't involve a rebase is if there have been more changes to the branch from another user or directly from GitLab that you don't have on your local branch. If you don't pull those newer changes before making other changes, a force push would be required. But a force push would also be destructive so you probably don't want to do that. Instead, you would want to first pull those changes, as I gave in the first example, and then do a regular push after making your changes.
Hi guys,
How can I configure my project to only accept merge request that mentions at least one issue ?
Thanks !