Interview Prep/Git & GitHub/Branching and Merging Workflows

You squash-merged a PR, and `git branch -d feature` says the branch is not fully merged. Is something wrong?

IntermediateScenarioBranching and Merging Workflows
Answer

Situation read → Squash merge creates a new commit with different content ancestry. The original feature commits are not ancestors of main.

What I'd do →

  1. Confirm the PR shows as merged on GitHub and the squash commit is in main.
  2. Delete the branch with git branch -D feature.
  3. Turn on "Automatically delete head branches" in repo settings, and run git fetch --prune locally.

Why → -d checks ancestry, and squash breaks it. Content is merged but history is not.

Interview tip → Know the trade-off: squash gives clean history but makes -d, git branch --merged and later merges from the same branch unreliable.

All Git & GitHub questions Roadmap: Git & GitHub

More on Branching and Merging Workflows