If nothing new landed on main while you worked on a branch, git merge just moves the main pointer forward. The history ends up as one straight line and nobody can tell afterwards that those commits were once a feature of their own. One flag changes that.
git switch main
git merge --no-ff feature -m "Merge feature"
The documentation says that with --no-ff Git creates a merge commit in all cases, even when the merge could instead be resolved as a fast-forward. In a throwaway repository, where the branch ff1 has one commit on top of main, a plain merge only moves the pointer. With the flag, git log --oneline --graph shows a merge commit with the branch commit hanging off it:
* 7d8df18 Merge ff1
|\
| * 2cd994f x
|/
* 94d110f Add feature (squashed)
The payoff comes later: you can see where the feature started and ended, and the merge commit is one place to point at when someone asks when it landed.
If you want this every time, there is a setting for it: git config merge.ff false. The docs describe it as the same as giving --no-ff on the command line.
One caveat: when the branch is a real divergence, Git makes a merge commit anyway, so the flag changes nothing there. It only matters for the fast-forward case. And the extra commit is the whole point, so if you like a perfectly linear history, leave the flag out and rebase before you merge instead.
Further reading: git-merge documentation