Claude Skills Guide

Claude Code for Git Absorb Workflow Tutorial

Git Absorb is a powerful tool that automatically cleans up your commit history by absorbing fixup commits into their parent commits. When combined with Claude Code, you get an intelligent assistant that can identify when fixup commits are needed, create them appropriately, and then run git absorb to maintain a clean, readable commit history. This tutorial walks you through setting up and using this powerful combination.

What is Git Absorb?

Git Absorb analyzes your branch’s commits and automatically finds fixup commits that can be absorbed into their corresponding original commits. Unlike traditional approaches where you manually identify which commits to squash or fix, Git Absorb uses a smart algorithm to match fixup commits with their parent commits based on the files they modify.

For example, if you have a commit that adds a new feature and later create a fixup commit that touches the same files, Git Absorb will automatically squash them together when you run the command. This keeps your history clean without requiring you to remember which commits belong together.

Installing Git Absorb

Before you can use Git Absorb with Claude Code, you need to install it on your system. The installation process varies by operating system.

macOS Installation

The easiest way to install Git Absorb on macOS is using Homebrew:

brew install git-absorb

Linux Installation

On Linux, you can install Git Absorb using the package manager or by building from source:

# Using apt (Debian/Ubuntu)
sudo apt install git-absorb

# Or build from source
git clone https://github.com/tiborsimko/git-absorb.git
cd git-absorb
cargo install --locked git-absorb

Verify Installation

After installation, verify that Git Absorb is available:

git absorb --version

You should see the version number printed to your terminal.

Setting Up Git Absorb with Claude Code

To use Git Absorb effectively with Claude Code, you need to ensure Claude has the necessary context about your workflow. Create a CLAUDE.md file in your project root with the following guidance:

## Git Workflow Preferences

When I make changes that should be absorbed into a previous commit:
- Create a fixup commit using: git commit --fixup=<commit-hash>
- Mark the commit with git absorb --auto

Use "git log --oneline" to show recent commits so I can identify which one needs fixing.

This tells Claude Code how to interact with Git Absorb and when to create fixup commits.

Practical Workflow Examples

Scenario 1: Fixing a Bug After Feature Commit

Imagine you committed a new feature but discovered a bug in the same code. Instead of amending the commit (which rewrites history) or adding a new commit, you can use Git Absorb to create a clean solution.

First, check your recent commits:

git log --oneline -5

Let’s say you see:

a1b2c3d Add user authentication feature
e5f6g7h Initial commit

You discovered a bug in the authentication feature. Make your fix, then create a fixup commit:

git add -A
git commit --fixup=a1b2c3d

Now run Git Absorb to clean up:

git absorb

Git Absorb will automatically squash the fixup commit into the original commit, giving you a clean history.

Scenario 2: Multiple Fixups for One Commit

When you have multiple fixes for a single commit, Git Absorb handles them all at once:

# Make first fix, stage it
git add filename1.js
git commit --fixup=a1b2c3d

# Make second fix, stage it  
git add filename2.js
git commit --fixup=a1b2c3d

# Run absorb to clean up all fixups at once
git absorb

This is much cleaner than manually rebasing and squashing multiple commits.

Scenario 3: Using Git Absorb with Auto Flag

The --auto flag makes Git Absorb even more powerful by automatically determining which commits can be absorbed without explicit configuration:

git absorb --auto

This works well when you want Claude Code to handle the entire process. Simply tell Claude: “Please clean up my commits using git absorb” and it will guide you through the process.

Integrating with Claude Code Commands

Claude Code can assist you throughout this workflow. Here are some useful commands and how Claude can help:

Checking Commit Status

Tell Claude: “Show me the recent commits in my branch”

Claude will run:

git log --oneline -10

Creating Fixup Commits

Tell Claude: “Create a fixup commit for the authentication commit”

Claude will identify the appropriate commit hash and create the fixup commit:

git commit --fixup=a1b2c3d

Running Git Absorb

Tell Claude: “Run git absorb to clean up my commits”

Claude will execute:

git absorb

If there are any conflicts, Claude will help you resolve them.

Best Practices for Git Absorb Workflow

Always Review Before Absorbing

Before running git absorb on published branches, review what will be absorbed:

git absorb --dry-run

This shows you exactly what would happen without making any changes.

Use Feature Branches

Git Absorb works best on feature branches that haven’t been pushed to shared repositories. This allows you to rewrite commit history without affecting others.

Combine with Conventional Commits

When used with conventional commit messages, Git Absorb helps maintain a clean, meaningful history:

feat(auth): add user login functionality
fix(auth): resolve token expiration issue

The fixup commits will be absorbed into the original commits, preserving meaningful messages.

Let Claude Guide the Process

When in doubt, ask Claude Code for help. You can say:

Claude will analyze your situation and provide guidance specific to your codebase.

Troubleshooting Common Issues

Conflicts During Absorb

If Git Absorb encounters conflicts, it will stop and let you resolve them manually. After resolving:

git add -A
git absorb --continue

Accidental Absorption

If you accidentally absorbed commits you wanted to keep separate, you can always reset:

git reset --soft HEAD~1

This undo the last absorption, letting you try again.

Protected Branches

Git Absorb won’t run on protected branches by default. If you need to absorb commits on a protected branch, you’ll need to temporarily disable branch protection or use a different approach.

Conclusion

Git Absorb combined with Claude Code provides a powerful workflow for maintaining clean commit histories. By automating the identification and absorption of fixup commits, you spend less time on manual cleanup and more time writing code. Remember to always review changes with --dry-run before absorbing, work on feature branches, and let Claude guide you through the process when you’re unsure.

Start using Git Absorb today, and you’ll wonder how you ever managed without it. Your future self (and your team members) will thank you when reviewing commit history.

Built by theluckystrike — More at zovo.one