git-rebase

Automate git rebase workflows with fixup commits and autosquash.

3|7|Updated Nov 7, 2025
One-click install
npx skills add https://github.com/dimagi/dimagi-claude-workflows --skill git-rebase-dimagi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-rebase
Source: https://github.com/dimagi/dimagi-claude-workflows/tree/main/plugins/dev_utils/skills/git-rebase
Command: npx skills add https://github.com/dimagi/dimagi-claude-workflows --skill git-rebase-dimagi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Use when squashing fixup commits into earlier commits, doing interactive rebase cleanup on a feature branch, recovering from a failed autosquash rebase, inserting a reformatting commit before existing code changes, or moving/splitting file changes between commits. Covers the standard fixup workflow, dropped-commit recovery, pitfalls of custom GIT_SEQUENCE_EDITOR scripts, the replay-and-reformat pattern, and the checkout-and-reconstruct pattern for rearranging commit contents.

Core Features & Use Cases

  • Guide and automate fixup-based rebasing to streamline commit history on feature branches.
  • Provide safe recovery steps using reflog and resets after failed rebases.
  • Demonstrate patterns for rearranging commits, including replay-and-reformat and checkout-and-reconstruct.
  • Warn about and avoid common pitfalls of custom GIT_SEQUENCE_EDITOR scripts.

Quick Start

Describe a safe, end-to-end git rebase workflow that uses fixup commits and autosquash for a feature branch.

Frequently Asked Questions about git-rebase

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

FAQPage Schema
How do I squash fixup commits into earlier commits during a git rebase?

To squash fixup commits, use an interactive git rebase with the autosquash option enabled, which automatically reorders and collapses fixup commits into their designated target commits to clean up feature branch history.

What is the best way to recover from a failed autosquash rebase?

Recover from a failed autosquash rebase by using git reflog to locate the previous HEAD state, then applying a git reset command to safely restore the branch to its original condition before the rebase attempt.

How do I rearrange and split file changes between existing commits in git?

Rearrange and split file changes between commits using the checkout-and-reconstruct pattern or the replay-and-reformat pattern, allowing you to move and reorganize code changes across different commits during an interactive rebase.

Why should I avoid custom GIT_SEQUENCE_EDITOR scripts for interactive rebasing?

Custom GIT_SEQUENCE_EDITOR scripts introduce pitfalls during interactive rebasing because they can fail to handle unexpected commit sequences or conflicts, making rebase workflows unsafe and breaking automated autosquash operations.

Can I insert a reformatting commit before existing code changes in a feature branch?

Yes, you can insert a reformatting commit before existing code changes by applying the replay-and-reformat pattern during a git rebase, allowing you to safely restructure commit order and separate formatting from functional changes.