Reputation: 41
I have a scenario where I created a merge-request in gitlab for few files from my new dev branch to master. I had a total of 9 commits in my dev branch. In my 3rd commit I had pushed few files which I later realized are no longer required.
So, now in my merge request out of 6 files I want to merge 3 files and want to close this specific merge request. I discovered few solutions which I am describing below but I am looking for a very specific solution.
1) Close this merge request. Create/Checkout a new dev branch change only those files which are required and create a new merge request.
2) Cherrypick the files which you want in your master branch keeping your merge request still open.
3) Merge this request and then cherry pick the changes on to the selected branch by creating a new merge request.
There might be other solutions which I am unaware of. However, I am looking for a specific solution where
I am not sure even if this possible. I just want to understand that does git/gitlab have any solution for this.
Upvotes: 2
Views: 13373
Reputation: 311918
You can just update the merge request.
Update your local branch to meet your requirements (i.e., revert the appropriate files with git checkout
and then update your commit with git commit --amend
), and then git push --force
your branch to gitlab.
This will update your existing merge request, which you can then merge and close normally.
Upvotes: 5