git-absorb
Automatically fold uncommitted changes into appropriate commits on a feature branch. Use when applying review feedback, fixing bugs in feature branches, or maintaining atomic commit history without manual interactive rebasing. Particularly useful for making corrections to recent commits without creating messy "fixes" commits.
What this skill does
# Git Absorb ## Overview `git absorb` automatically identifies which commits should contain your staged changes and creates fixup commits that can be autosquashed. This eliminates the need to manually find commit SHAs or run interactive rebases when applying review feedback or fixing bugs in feature branches. ## When to Use This Skill Use git-absorb when: - **Applying review feedback**: Reviewer pointed out bugs or improvements across multiple commits - **Fixing bugs**: Discovered issues in your feature branch that belong in specific earlier commits - **Maintaining atomic commits**: Want to keep commits focused without creating "fixes" or "oops" commits - **Avoiding manual rebasing**: Don't want to manually identify which commits need which changes ## Prerequisites **CRITICAL**: Before proceeding, you MUST verify that git-absorb is installed: ```bash git absorb --version ``` **If git-absorb is not installed:** - **DO NOT** attempt to install it automatically - **STOP** and inform the user that git-absorb is required - **RECOMMEND** manual installation with the following instructions: ```bash # macOS brew install git-absorb # Linux (Debian/Ubuntu) apt install git-absorb # Arch Linux pacman -S git-absorb # Cargo (all platforms) cargo install git-absorb # Other systems: see https://github.com/tummychow/git-absorb ``` **If git-absorb is not available, exit gracefully and do not proceed with the workflow below.** ### Important Default Behaviors Before using git-absorb, understand these key defaults: **Author Filtering**: By default, git-absorb **only modifies commits you authored**. It will not absorb changes into commits made by teammates. - To absorb into any author's commits, use `git absorb --force-author` - Or configure globally: `git config absorb.forceAuthor true` **Stack Size Limit**: By default, git-absorb searches only the **last 10 commits**. If you're working on a larger feature branch, you may need to: - Use `--base <branch>` to specify a range (e.g., `--base main`) - Or increase the limit in `.gitconfig` (see Configuration section below) **Staged Changes Only**: git-absorb only considers changes in the git index (staging area). Unstaged changes are ignored. ## Basic Workflow **ONLY proceed with this workflow if git-absorb is confirmed to be installed.** ### Step 1: Make Your Changes Make fixes or improvements to files in your working directory. ### Step 2: Stage the Changes ```bash git add <files-you-fixed> ``` **Important**: Only stage changes you want absorbed. git-absorb only considers staged changes. ### Step 3: Run git absorb **Option A: Automatic (recommended for trust)** ```bash git absorb --and-rebase ``` This creates fixup commits AND automatically rebases them into the appropriate commits. **Option B: Manual review** ```bash git absorb git log # Review the generated fixup commits git rebase -i --autosquash <base-branch> ``` Use this when you want to inspect the fixup commits before integrating them. ## Common Patterns ### Pattern 1: Review Feedback **Scenario**: PR reviewer found bugs in commits A, B, and C ```bash # 1. Make all the fixes vim file1.py file2.py file3.py # 2. Stage all fixes git add file1.py file2.py file3.py # 3. Let git-absorb figure out which fix goes where git absorb --and-rebase ``` git-absorb analyzes each change and assigns it to the appropriate commit. ### Pattern 2: Bug Fix in Feature Branch **Scenario**: Found a bug in an earlier commit while developing ```bash # 1. Fix the bug vim src/module.py # 2. Stage and absorb git add src/module.py git absorb --and-rebase ``` The fix is automatically folded into the commit that introduced the bug. ### Pattern 3: Multiple Small Fixes **Scenario**: Several typos, formatting issues across multiple commits ```bash # Fix everything first vim file1.py file2.py README.md # Stage and absorb in one go git add -A git absorb --and-rebase ``` ## Advanced Usage For comprehensive coverage of all flags and advanced patterns, see [references/advanced-usage.md](references/advanced-usage.md). **Key flags:** - `--base <commit>`: Specify range (e.g., `--base main`) - `--dry-run`: Preview without making changes - `--force`: Skip safety checks - `--one-fixup-per-commit`: Generate one fixup per target commit - `--verbose`: See detailed output **Example:** ```bash git absorb --base main --dry-run --verbose ``` ## Configuration For complete configuration reference with all options, see [references/configuration.md](references/configuration.md). **Most important configuration:** If you see "WARN stack limit reached, limit: 10", increase the stack size: ```bash git config absorb.maxStack 50 # Local git config --global absorb.maxStack 50 # Global ``` By default, git-absorb only searches the last 10 commits. For larger feature branches, increase this to 50 or higher. **Other useful configs:** - `oneFixupPerCommit`: One fixup per commit instead of per hunk - `autoStageIfNothingStaged`: Auto-stage all changes if nothing staged - `forceAuthor`: Allow absorbing into teammates' commits See [references/configuration.md](references/configuration.md) for details and all 7 configuration options. ## Recovery If something goes wrong or you're not satisfied: ```bash git reset --soft PRE_ABSORB_HEAD ``` This restores the state before running git-absorb. You can also find the commit in `git reflog`. ## How It Works git-absorb uses commutative patch theory: 1. For each staged hunk, check if it commutes with the last commit 2. If not, that's the parent commit for this change 3. If it commutes with all commits in range, leave it staged (warning shown) 4. Create fixup commits for absorbed changes This ensures changes are assigned to the correct commits based on line modification history. ## Safety Considerations - **Always review**: Use manual mode first until comfortable with automatic mode - **Local only**: Only use on local branches, never on shared/pushed commits - **Backup**: git-absorb is safe, but `git reflog` is your friend - **Test after**: Run tests after absorbing to verify nothing broke ## Troubleshooting **"WARN stack limit reached, limit: 10"** - git-absorb only searches the last 10 commits by default - Increase the stack size: `git config absorb.maxStack 50` - Or use `--base <branch>` to specify the range (e.g., `--base main`) - See the Configuration section above for details **"Can't find appropriate commit for these changes"** - The changes may be too new (modify lines not in recent commits) - Try increasing the range with `--base <branch>` - Try increasing stack size: `git config absorb.maxStack 50` - Changes may need to be in a new commit **"Command not found: git-absorb"** - Not installed. See Prerequisites section above for manual installation instructions - Do NOT attempt automatic installation **"Conflicts during rebase"** - Some changes couldn't be absorbed cleanly - Resolve conflicts manually or use `git rebase --abort` - Consider breaking changes into smaller pieces
Related in Code Review
gstack
IncludedFast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)
startup-due-diligence
IncludedLegal due diligence review for seed-stage and Series A startups (US, Delaware C-Corp focus). Supports both investor and founder perspectives. Capabilities include: (1) Interactive document review and issue spotting; (2) Document request list generation; (3) Cap table and SAFE/convertible note analysis; (4) Red flag identification with severity ratings; (5) Diligence report generation. TRIGGERS: due diligence, DD, startup investment, cap table review, Series A, seed round, investor diligence, legal review startup, SAFE analysis, convertible note, 409A, founder vesting.
interview-master
IncludedThis skill should be used when the user asks to "generate interview questions", "prepare for interview", "optimize resume", "conduct mock interview", "analyze git commits for resume", "generate resume from code", "review my resume", or mentions interview preparation, career assistance, or extracting project experience from git history. Provides comprehensive interview and career development guidance for both job seekers and interviewers.
fix-issue
IncludedFixes GitHub issues using parallel analysis agents for root cause investigation, code exploration, and regression detection. Reads issue context from gh CLI, searches codebase and memory for related patterns, generates a fix with tests, and links the resolution back to the issue via PR. Includes prevention analysis to avoid recurrence. Use when debugging errors, resolving regressions, fixing bugs, or triaging issues.
sf-apex
IncludedGenerates and reviews Salesforce Apex code with 150-point scoring. TRIGGER when: user writes, reviews, or fixes Apex classes, triggers, test classes, batch/queueable/schedulable jobs, or touches .cls/.trigger files. DO NOT TRIGGER when: LWC JavaScript (use sf-lwc), Flow XML (use sf-flow), SOQL-only queries (use sf-soql), or non-Salesforce code.
swift-development
IncludedComprehensive Swift development for building, testing, and deploying iOS/macOS applications. Use when Claude needs to: (1) Build Swift packages or Xcode projects from command line, (2) Run tests with XCTest or Swift Testing framework, (3) Manage iOS simulators with simctl, (4) Handle code signing, provisioning profiles, and app distribution, (5) Format or lint Swift code with SwiftFormat/SwiftLint, (6) Work with Swift Package Manager (SPM), (7) Implement Swift 6 concurrency patterns (async/await, actors, Sendable), (8) Create SwiftUI views with MVVM architecture, (9) Set up Core Data or SwiftData persistence, or any other Swift/iOS/macOS development tasks.