Search code examples
gitlabgitlab-cigit-commitmerge-request

MR squash is removing commit message details


I was working in a branch and my commit had a very detailed message. The format was:

Title

Details (multiple lines). 

I created an MR but when the MR was merged I can see the merge commit and my new commit with only the Title. The details are gone. If I do git show $sha on either the $sha of my local branch or do git log on the remote branch I can see the full message.
But in master I can only see the title.
How can this be happening? Is there some Gitlab configuration that could be causing this?

Update after @Ôrel comment:
The squash commits was preselected.
The branch had 2 commits with the same format i.e. Title/Detailed message.
The merged (squashed) commit has the title of one commits (not the one that was top of the branch) and the details removed. How is the commit message selected in this kind of squash/merge?


Solution

  • By default gitlab will use the title of the merge request on squash commit

    %{title}
    

    you can add more info cf https://docs.gitlab.com/ee/user/project/merge_requests/commit_templates.html#default-template-for-squash-commits

    If you want to keep info from commits you can use a template like:

    %{title}
    
    %{all_commits}
    

    To find the template

    1. On the top bar, select Main menu > Projects and find your project.
    2. On the left sidebar, select Settings > Merge requests.

    enter image description here