git-squash-merge-tree-hash-diagnosis

Compare Git tree hashes to diagnose squash-merged branches.

Updated Nov 18, 2025
One-click install
npx skills add https://github.com/cajias/claude-skills --skill git-squash-merge-tree-hash-diagnosis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-squash-merge-tree-hash-diagnosis
Source: https://github.com/cajias/claude-skills/tree/main/plugins/git-workflow/skills/git-squash-merge-tree-hash-diagnosis
Command: npx skills add https://github.com/cajias/claude-skills --skill git-squash-merge-tree-hash-diagnosis

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you determine whether a branch that appears to be many commits ahead of main actually contains new work, or whether its changes were already absorbed by a squash merge on GitHub.

Core Features & Use Cases

  • Tree-hash verification: Compares branch and origin/main tree hashes to prove whether the file state is identical, regardless of misleading commit history.
  • Post-merge cleanup: Explains how to safely reset a divergent local main and remove branches that were squash-merged.
  • Git diagnostics: Clarifies why cherry-pick style checks, three-dot diffs, and rebasing can mislead you after squash merges.
  • Use Case: A developer sees a branch with many commits still showing as ahead after the PR was merged; this Skill identifies the branch as fully integrated and guides the safe cleanup steps.

Quick Start

Ask the assistant to compare your branch tree hash with origin/main, confirm whether a squash merge already absorbed the work, and tell you whether to reset local main or delete the branch.

Frequently Asked Questions about git-squash-merge-tree-hash-diagnosis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my Git branch still show commits ahead after a GitHub squash merge?

A branch shows commits ahead after a squash merge because squash merges create a new commit on main without recording the original branch commits, leaving the branch history intact and appearing divergent. Comparing tree hashes confirms the file state is actually identical.

How do I check if a branch was fully absorbed by a squash merge?

To check if a branch was absorbed by a squash merge, compare the branch tree hash with origin/main using git. If the tree hashes match, the file contents are identical, proving the work was fully integrated and only ghost commits remain.

What is the best way to clean up local branches after a squash merge on GitHub?

The best way to clean up branches after a squash merge is to verify tree hashes match, then safely reset your divergent local main to origin/main and delete the fully integrated branch, avoiding misleading rebase or cherry-pick checks.

Do git cherry-pick checks and three-dot diffs work after a squash merge?

Cherry-pick checks and three-dot diffs mislead you after a squash merge because they rely on commit history rather than file state. Since squash merges rewrite commit ancestry, these methods fail to recognize identical tree hashes.

When should I reset local main instead of rebasing after a divergent branch merge?

You should reset local main instead of rebasing when tree hash verification proves your branch contains only ghost commits. Rebasing would replay empty commits, while resetting aligns your local main directly with origin/main.

How does comparing tree hashes diagnose ghost commits in Git?

Comparing tree hashes diagnoses ghost commits by proving file content parity between a branch and origin/main. If the hashes match despite divergent commit graphs, it confirms the branch holds no new work and only contains ghost commits.