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.
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
- Automatic fixup targeting — uses git blame to identify which commit owns each staged hunk
- Safe — never wrong — if git-absorb is uncertain, it leaves changes unstaged rather than creating an incorrect fixup
- Multiple fixups at once — stages across multiple files create multiple fixup commits targeting the correct parents in one pass
- Works with autosquash — pairs directly with
git rebase -i --autosquashfor one-command cleanup - Configurable range — controls how many commits back git-absorb looks for fixup targets
- Written in Rust — fast, dependency-free binary available on all major platforms
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 commit | git log / git blame manually | Automatic |
| Create fixup | git commit --fixup=<hash> | git absorb (automatic) |
| Multiple targets | Repeat for each commit | One command |
| Merge fixups | git rebase --autosquash | git rebase --autosquash |
| Risk of wrong target | Yes (human error) | Very low (safe by default) |
Use Cases
- Incorporating code review feedback into the correct original commit without polluting history
- Cleaning up a feature branch before merging with a squash-friendly team workflow
- Fixing typos or minor errors from commits made earlier in the same branch
- Maintaining atomic, reviewable commits when a PR spans many logical changes
- Pairing with lazygit or other TUIs that support autosquash-based rebase workflows
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.
Related Products
on GumroadDeveloper Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →Premium Workflow Pack
Production-grade workflows, architecture guides, and deployment scripts for teams that ship. 10 advanced CI/CD workflows (blue-green, canary, E2E, security), 5 architecture deep-dives, code review checklist, PR process guide, and 5 battle-tested Bash deployment scripts.
Buy on Gumroad →You Might Also Need
Git Stash Manager
Visual reference for git stash commands. Copy-ready stash push, pop, apply, drop, list, and branch commands with stash index control. Free git stash cheat sheet.
Open free tool →
GitHub Actions Workflow Generator
Generate GitHub Actions YAML workflows instantly. Choose triggers (push, PR, schedule), runtime (Node.js, Python, Go, Rust), and jobs (test, lint, build, Docker, GitHub Pages). Copy-ready .github/work
Open free tool →
GitHub Actions YAML Linter
Lint your GitHub Actions workflow YAML before pushing. Catches broken needs references, invalid trigger events, hardcoded secrets, unversioned action pins, and YAML syntax errors. Free browser tool.
Open free tool →
More Free Tools
Related Articles
Git Workflow Best Practices 2025: Team-Proven Strategies
Git workflow best practices for 2025: branching strategies, commit conventions, PR reviews, rebasing vs merging, and CI/CD integration that teams actually use.
Git Branching Strategies Compared 2026: GitFlow vs Trunk-Based vs GitHub Flow
Compare the top Git branching strategies for 2026 — GitFlow, GitHub Flow, Trunk-Based Development, and GitLab Flow. Choose the right workflow for your team's size, release cadence, and CI/CD setup.
Git Merge vs Rebase: When to Use Each
Git merge vs rebase — understand the real difference, when each strategy makes sense, and which one to choose for your team's workflow. Includes practical examples and common mistakes to avoid.
Advanced Git Workflows in 2026: Worktrees, Bisect, Interactive Rebase, and More
Master advanced Git workflows that most developers never use. Git worktrees for parallel branches, git bisect for hunting bugs, interactive rebase for clean history, sparse checkout for monorepos, and power-user config tips.
Aider AI: The Ultimate Terminal-Based AI Coding Assistant for 2026
Complete guide to Aider AI coding assistant. Setup, best practices, model options, and how this terminal-based tool compares to GUI editors for serious developer workflows.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$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.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →