So there's 3 options when merging a PR in Github:
-
Create a merge commit
-
Squash and merge
-
Rebase and merge
Just looking at https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges, I still had a few questions on exactly what git commands Github is using when merging a PR.
Create a merge commit
Is this just git merge --no-ff?
It looks like you'll always have a merge commit, regardless whether the PR branch had diverged or not.
Squash and merge
Is this squashing commits (git rebase -i) and then git merge or git cherry-pick?
It looks like for both diverged/non-diverged branches, this always results in your squashed commit going in linearly onto the main branch.
Rebase and merge
This one I'm more confident about. This looks like a git rebase and git merge.
It rebases your feature branch onto main, then merges all the commits in, putting all feature commits into the main branch. This is opposed to the other options which either give you a merge commit or one squashed commit.