// 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.
| name | git-absorb |
| description | 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. |
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.
Use git-absorb when:
CRITICAL: Before proceeding, you MUST verify that git-absorb is installed:
git absorb --version
If git-absorb is not installed:
# 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.
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.
git absorb --force-authorgit config absorb.forceAuthor trueStack 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:
--base <branch> to specify a range (e.g., --base main).gitconfig (see Configuration section below)Staged Changes Only: git-absorb only considers changes in the git index (staging area). Unstaged changes are ignored.
ONLY proceed with this workflow if git-absorb is confirmed to be installed.
Make fixes or improvements to files in your working directory.
git add <files-you-fixed>
Important: Only stage changes you want absorbed. git-absorb only considers staged changes.
Option A: Automatic (recommended for trust)
git absorb --and-rebase
This creates fixup commits AND automatically rebases them into the appropriate commits.
Option B: Manual review
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.
Scenario: PR reviewer found bugs in commits A, B, and C
# 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.
Scenario: Found a bug in an earlier commit while developing
# 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.
Scenario: Several typos, formatting issues across multiple commits
# Fix everything first
vim file1.py file2.py README.md
# Stage and absorb in one go
git add -A
git absorb --and-rebase
For comprehensive coverage of all flags and advanced patterns, see 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 outputExample:
git absorb --base main --dry-run --verbose
For complete configuration reference with all options, see references/configuration.md.
Most important configuration:
If you see "WARN stack limit reached, limit: 10", increase the stack size:
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 hunkautoStageIfNothingStaged: Auto-stage all changes if nothing stagedforceAuthor: Allow absorbing into teammates' commitsSee references/configuration.md for details and all 7 configuration options.
If something goes wrong or you're not satisfied:
git reset --soft PRE_ABSORB_HEAD
This restores the state before running git-absorb. You can also find the commit in git reflog.
git-absorb uses commutative patch theory:
This ensures changes are assigned to the correct commits based on line modification history.
git reflog is your friend"WARN stack limit reached, limit: 10"
git config absorb.maxStack 50--base <branch> to specify the range (e.g., --base main)"Can't find appropriate commit for these changes"
--base <branch>git config absorb.maxStack 50"Command not found: git-absorb"
"Conflicts during rebase"
git rebase --abort