Every time a tool says “compared with where you branched off”, it means the merge base. You can ask git for that commit directly.
git merge-base main feature
The output is one full commit hash: the best common ancestor of the two branches. I find it most useful inside other commands. For example, to see all changes on your branch as one diff, including uncommitted work:
git diff $(git merge-base main HEAD)
That’s different from git diff main...HEAD, which only compares commits and ignores what you haven’t committed yet.
It also helps when you want to squash a whole branch by hand. git reset --soft $(git merge-base main HEAD) moves the branch back to the fork point and keeps all changes staged, ready for one new commit.
There’s a yes or no form as well: git merge-base --is-ancestor A B exits with 0 when A is an ancestor of B. That’s handy in a script that should only continue when a fix is already in a branch.
After you’ve merged main into your branch a few times, the merge base moves up to the last merged main commit, not the original branch point. That’s usually what you want, but it can be a surprise the first time. In rare criss-cross histories there can be more than one best ancestor; --all prints them all.
Further reading: git-merge-base documentation