During merge I use both Delete source branch when merge request is accepted and Squash commits when merge request is accepted options.
Gitlab does his job perfectly: It squash commits to the single one and merge it to the target branch.
But it also keeps original commits - you can see them in Commits tab of merge request page:
I want to be able to checkout to these commits. But in new cloned repository, git can't find them by hash:
$ git checkout c8ad8edf
error: pathspec 'c8ad8edf' did not match any file(s) known to git
I think this happens because git clone gets only commits that can be reach from the initial commit. But GitLab stores this information - I can view info of any commit in browser:
So how can I checkout to these commits?




You can fetch the
refs/merge-requests/$id/headref, where$idis the numerical ID of the merge request (3 in your case, from your screenshots): see Checkout merge requests locally through the head ref. Note that in GitLab 13.4 and newer, that ref is deleted 14 days after the MR is merged or closed.