consolidate-commits

Restructures a feature branch's commits into a minimal, reviewable history with a byte-identical final tree.

9.9k|1.8k|Updated Aug 8, 2016
One-click install
npx skills add https://github.com/gitkraken/vscode-gitlens --skill consolidate-commits
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: consolidate-commits
Source: https://github.com/gitkraken/vscode-gitlens/tree/main/.claude/skills/consolidate-commits
Command: npx skills add https://github.com/gitkraken/vscode-gitlens --skill consolidate-commits

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Feature branches accumulate messy history: fixup commits, add-then-undo churn, and redesigns that bury the final approach under abandoned iterations. This Skill consolidates a branch's commits into the minimum number of valuable, reviewable commits while guaranteeing the final tree is byte-identical to the original tip.

Core Features & Use Cases

  • Churn Detection: Audits commits for add-then-undo pairs and approach churn (redesigns that replace earlier work) using git diff analysis and commit-by-commit reading.
  • Safe Non-Interactive Rewriting: Uses commits, cherry-picks, and detached HEAD checkouts instead of interactive rebase or stash, with a backup branch and mandatory empty-diff verification.
  • Commit Curation Criteria: Balances minimum count, mergeability, reviewability, and separation of concerns so each commit tells one story and every prefix of the branch could plausibly land.
  • Use Case: Before opening a PR on a GitLens feature branch with 15 noisy commits including "fixes from testing" and a mid-branch redesign, consolidate them into 3 clean commits that a reviewer can read one story at a time.

Quick Start

Ask the AI to consolidate the current branch's commits into a clean, reviewable history while verifying the final tree matches the original tip exactly.

Frequently Asked Questions about consolidate-commits

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

FAQPage Schema
Why avoid git stash when restructuring branch history?

The stash stack is shared across worktrees, so stashing uncommitted work during a rewrite risks collisions. Instead, commit uncommitted changes as a temporary WIP commit and restore them afterward by checking out their paths from that commit.