Will all commits be accepted when merge request is approved?

Viewed 39

i misclicked some stuff and when i created a merge request there is a commit that says:

"Merge branch 'master' of [repo link] into my-branch"

if my merge request is accepted will that commit be done? and if not, how can i remove it?

but the pipeline only shows the commit that i want to be approved (not sure of this matters)

1 Answers

The pipeline shows only the one "last" (most recent) commit of your branch.

Your branch may have deviated from the target branch by one or more commits.

If you'd like your MR to contain just one single commit, you could do this:

  • get the commit-id of your wanted commit (e.g. abcd1234)
  • reset the branch to master: git reset --hard origin/master
  • re-apply the commit: git cherry-pick abcd123
  • overwrite the branch on the remote: git push --force

At this point, the MR view should show just a single commit under "Commits". Under "pipelines", there will be pipelines for the previous commits, but that's not relevant.

I think the most important view is "changes", make sure all changes you want to approve are shown there (and nothing else).

Related