Skip to main content

git-absorb

Automatically create git commit --fixup commits for your staged changes. git-absorb identifies which existing commit owns each changed line and generates the fixup — then git rebase --autosquash folds them in for a perfectly clean history.

✓ Automatic fixup targeting ✓ Works with autosquash rebase ✓ Written in Rust ✓ Open source (BSD-3)

What is git-absorb?

git-absorb is a Git extension written in Rust that automates the tedious part of maintaining a clean feature branch: correctly attributing review fixes to the right original commit. When a code reviewer asks for changes, you typically make those changes and then need to figure out which commit introduced the affected code, create a fixup commit targeting that commit, then rebase to clean up.

git-absorb does the attribution automatically. It runs git blame on your staged changes, identifies which commits in your branch introduced those lines, and creates git commit --fixup commits pointing to them. Run git rebase --autosquash afterward and your history is clean.

Key Features

Installation

# macOS (Homebrew)
brew install git-absorb

# Rust / Cargo (any platform)
cargo install git-absorb

# Nix
nix-env -iA nixpkgs.gitAndTools.git-absorb

# Arch Linux (AUR)
yay -S git-absorb

After installation, git absorb is available as a git subcommand in any repository.

Complete Workflow Example

# 1. You have a feature branch with several commits:
#    c1: Add user model
#    c2: Add auth middleware
#    c3: Add login endpoint

# 2. Your reviewer asks for a small fix in the user model.
#    Make the fix, then stage the changes:
git add src/models/user.ts

# 3. Run git absorb — it figures out which prior commit owns this code:
git absorb
# Output: absorbed 1 hunk into fixup! Add user model

# 4. Autosquash to merge the fixup into the original commit:
git rebase --autosquash origin/main
# Result: a clean history with the fix baked into "Add user model"

# 5. Force-push the cleaned-up branch:
git push --force-with-lease

git-absorb vs Manual Fixup Commits

Step Manual fixup git absorb
Find target commitgit log / git blame manuallyAutomatic
Create fixupgit commit --fixup=<hash>git absorb (automatic)
Multiple targetsRepeat for each commitOne command
Merge fixupsgit rebase --autosquashgit rebase --autosquash
Risk of wrong targetYes (human error)Very low (safe by default)

Use Cases

Pros and Cons

Pros

  • ✓ Eliminates the tedious "which commit do I fixup?" step
  • ✓ Handles multiple fixup targets in a single run
  • ✓ Safe — leaves ambiguous changes unstaged rather than guessing
  • ✓ Produces perfectly clean history after autosquash rebase
  • ✓ Fast Rust binary, minimal install footprint

Cons

  • ✗ Only works on linear branch history (no merge commits)
  • ✗ Cannot absorb hunks in brand-new files (no blame target)
  • ✗ Requires rebase comfort — not for teams that use merge-only workflows
  • ✗ Less useful on short branches with only one or two commits
  • ✗ Rewriting history requires force-push on shared branches

Frequently Asked Questions

What is git absorb?▼

git-absorb is a Git extension that automatically creates fixup commits for your staged changes. It analyzes which lines you changed, figures out which existing commit in your branch originally introduced those lines, and creates a 'git commit --fixup' pointing to that commit. You then run 'git rebase --autosquash' to merge the fixup into the original commit, resulting in a clean linear history.

What is a fixup commit?▼

A fixup commit is a special commit created with 'git commit --fixup=<hash>'. It is named 'fixup! Original commit message'. When you run 'git rebase -i --autosquash', Git automatically moves fixup commits immediately after their target commits and marks them to be squashed with no separate commit message. The result is the original commit with the fix incorporated, as if you had committed it correctly the first time.

How does git absorb differ from manually creating fixup commits?▼

Manually creating fixup commits requires you to identify the correct target commit hash, run 'git commit --fixup=<hash>' with that hash, then rebase. git absorb automates the identification step — it uses blame information to determine which commit originally wrote the lines you are now modifying, and creates the fixup commit automatically. For a branch with many commits, this saves significant time and reduces errors from targeting the wrong commit.

What is a typical git absorb workflow?▼

1. Make a series of commits on your feature branch. 2. Receive review feedback requiring small changes. 3. Stage the changes with 'git add'. 4. Run 'git absorb' — it creates one fixup commit per target commit. 5. Run 'git rebase --autosquash origin/main' to squash all fixup commits into their targets. 6. Force-push with '--force-with-lease'. The reviewer sees a clean, linear history without noisy 'address review feedback' commits.

What happens when git absorb cannot identify the target commit?▼

If git absorb cannot confidently determine which commit to fix up (because the changed lines are new, too ambiguous, or span multiple commits), it will leave those changes unstaged in the working tree and report that it could not absorb them. You can then manually stage them and create a normal commit or a manual fixup commit. git absorb will never make a wrong fixup — it only acts when it is confident.

Does git absorb work with merge commits or only linear history?▼

git absorb works best on linear (rebased) branches without merge commits. It looks at the commits between HEAD and the merge base with the main branch to find fixup targets. On branches with merge commits, the range it analyzes may be incorrect. Stick to a rebase-based workflow (squash/rebase rather than merge) for the best git absorb experience.

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →