My question is: how do I get my local git merge behavior to resemble the way it works when I do a pull request from a branch back to main in GitHub, i.e. showing a branched commit history rather than a rebase-like history? I don't have it set to automatically do anything with rebase from what I can tell -- see details below.
Here's the scenario:
main
branch is clean.git checkout -b test-branch
.test-branch1
. Here's what git graph shows:My user gitconfig just has my name and email address, and here is what my repo git config looks like (i.e. no rebase setting from what I can tell):
So again, my question is how do I get my local merge behavior to resemble the way it works when I do a pull request from a branch back to main in GitHub, i.e. maintaining the separate commit history from the branch?
--no-ff
flag in git prevents the execution of a "fast-forward" merge and it's the merge method that GitHub uses in pull requests. - reference.
git merge <branch-name> --no-ff
git pull <remote-name> <branch-name> --no-ff
You might consider --ff-only
flag as well.