This changes the behaviour of when I run git pull to always include --rebase by default and to only allow fast-forward merges and pulls.
Only allowing fast-forward merges avoids merge commits as Git can just move the pointer for the branch to the latest commit.
If I can't do a fast-forward merge, I need to rebase first to update everything and bring it up to date.
Sometimes, when working in team, merge commits will still creep in sometimes and there are situations where you can only create a merge commit.
In this situation, I can do git merge --ff to allow a merge commit temporarily, but this is the exception instead of the default.
Hint: there's a lot more information on the configuration and arguments if you run and read man git-merge.
When working with online tools such as GitHub and GitLab, I avoid any options like Squash and merge or Create a merge commit and will use rebase options, although I've seen where different commit IDs have been generated when merged in the UI, which is why I prefer to do merges locally.
I'm an Acquia-certified Drupal Triple Expert with 17 years of experience, an open-source software maintainer and Drupal core contributor, public speaker, live streamer, and host of the Beyond Blocks podcast.