git-history-cleanup

Collapse related Git commits into topic-focused commits on feature branches.

896|86|Updated May 1, 2021
One-click install
npx skills add https://github.com/tksuoran/erhe --skill git-history-cleanup
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-history-cleanup
Source: https://github.com/tksuoran/erhe/tree/main/.claude/skills/git-history-cleanup
Command: npx skills add https://github.com/tksuoran/erhe --skill git-history-cleanup

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill cleans up your Git history by collapsing multiple WIP/fix-to-fix commits into a small set of topic-focused commits, preserving intent and making your branch history more readable.

Core Features & Use Cases

  • Collapse Commits: Merges related commits into a single topic-focused commit.
  • Preserve Intent: Retains original commit messages to maintain the context of changes.
  • Soft Reset: Performs a non-destructive reset to the origin/main branch.
  • Use Case: Before opening a pull request or merging, use this Skill to clean up your branch history to avoid noisy logs and ensure a clean commit history.

Quick Start

Run the git-history-cleanup skill on your feature branch to streamline your commit history.

Frequently Asked Questions about git-history-cleanup

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

FAQPage Schema
How do I clean up Git commit history before merging a feature branch?

To clean up Git commit history, you can collapse multiple WIP and fix-to-fix commits into a single topic-focused commit. This Skill performs a non-destructive soft reset to streamline your branch history and preserve commit intent.

What is the best way to collapse WIP commits into a readable Git history?

The best way to collapse WIP commits into a readable Git history is by merging related commits into a small set of topic-focused commits. This preserves the original context of changes while removing noisy commit logs from your feature branch.

Do I need a clean working copy to optimize my branch commit history?

Yes, you need a clean working copy and a linear branch history to optimize your branch commit history. A non-destructive soft reset to the origin/main branch requires this clean state to safely collapse related commits before merging.

When should I streamline my Git history before opening a pull request?

You should streamline your Git history before opening a pull request or merging to avoid noisy logs and ensure a clean commit history. Collapsing related commits at this stage preserves branch readability and maintains the original change intent.

Can I preserve original commit messages when squashing Git commits?

Yes, you can preserve original commit messages when squashing Git commits. The history cleanup process retains original commit messages to maintain the context of changes while collapsing multiple commits into a single topic-focused entry.

What happens to my branch history during a Git commit cleanup?

During a Git commit cleanup, your branch history undergoes a non-destructive soft reset to the origin/main branch. This action collapses related commits into a focused history without permanently deleting your original commit intent and context.