Interview Prep/Git & GitHub/Merge, rebase and cherry-pick

Why does a squash-merged branch show as unmerged to `git branch --merged`?

IntermediateConceptMerge, rebase and cherry-pick
Answer

Squash creates a new commit with no parent link to the feature commits, so the feature tip is not an ancestor of main. Git cannot see it as merged. Delete the branch with -D after confirming the PR merged, or use git cherry or git log --cherry to compare patch IDs, and enable auto-delete of head branches on GitHub.

git cherry -v main feature
All Git & GitHub questions Roadmap: Git & GitHub

More on Merge, rebase and cherry-pick