I am trying to merge a merge request (Gitlab) from command line.
After working on a dummy repository, I came to know that if I have the permission to merge a merge request, I can merge them directly through command line.
I started by cloning the upstream repository in my local system. After that, I made a change in my forked repository and created a merge request for the same.
While manually trying to merge the request from command line using this approach, I am getting an extra commit which is a merge commit(--no-ff).
git fetch <Fork_Repo_URL> <Fork_Repo_Branch>
git checkout -b <Branch_Name> FETCH_HEAD
git fetch origin
git checkout origin/master
git merge --no-ff <Remote_Name>-<Branch_Name>
git push origin master
Note: The above commands are used from the cloned upstream repository.
Now, I want to do the same without cloning the upstream repository and rather by just adding an upstream remote to my forked repository.
I followed all the steps mentioned in gitlab docs for merging the request manually, but to my surprise, I am unable to see any merge commit, although the merge request is merged after using those commands.
git remote add central <Central_Repo_URL>
git fetch origin master
git checkout -b my_master FETCH_HEAD
git fetch central
git checkout central/master
git merge --no-ff my_master-master
git push central master
So, is there any way to merge a merge request by configuring a remote in forked repository(I have permission), and generate a merge commit as well?
I tried this way as well.
git fetch central
git checkout central/master
git merge --no-ff origin/master
git push central master
I have also tried commit amend, rebase.