| GIT-ABSORB(1) | git absorb | GIT-ABSORB(1) |
NAME
git-absorb - Automatically absorb staged changes into your current branch
SYNOPSIS
git absorb [FLAGS] [OPTIONS]
DESCRIPTION
You have a feature branch with a few commits. Your teammate reviewed the branch and pointed out a few bugs. You have fixes for the bugs, but you don’t want to shove them all into an opaque commit that says fixes, because you believe in atomic commits. Instead of manually finding commit SHAs for git commit --fixup, or running a manual interactive rebase, do this:
$ git add $FILES_YOU_FIXED $ git absorb --and-rebase (or) $ git absorb $ git rebase -i --autosquash master
git absorb will automatically identify which commits are safe to modify, and which indexed changes belong to each of those commits. It will then write fixup! commits for each of those changes. You can check its output manually if you don’t trust it, and then fold the fixups into your feature branch with git’s built-in autosquash functionality.
FLAGS
-r, --and-rebase
-n, --dry-run
--no-limit
This will consider all commits until either root, merge commit, or a commit by other author (unless --force-author is used)
Which is why you should be careful when using this flag.
--force-author
--force-detach
-F, --one-fixup-per-commit
-f, --force
-s, --squash
When this flag is used, "fixup commit" may be read as "squash commit" throughout the documentation. All configuration relating to fixup commits will apply to the squash commits instead.
-w, --whole-file
-h, --help
-V, --version
-v, --verbose
OPTIONS
-b <base>, --base <base>
-m <MESSAGE>, --message <MESSAGE>
--gen-completions <SHELL>
-- <REBASE_OPTIONS>
USAGE
CONFIGURATION
STACK SIZE
When run without --base, git-absorb will only search for candidate commits to fixup within a certain range (by default 10). If you get an error like this:
WARN stack limit reached, limit: 10
edit your local or global .gitconfig and add the following section:
[absorb]
maxStack=50 # Or any other reasonable value for your project
Stack size can also be disabled temporarily for one command (see --no-limit)
ONE FIXUP PER FIXABLE COMMIT
By default, git-absorb will generate separate fixup commits for every absorbable hunk. To always generate only 1 fixup commit for all hunks that absorb into the same commit, edit your local or global .gitconfig and add the following section:
[absorb]
oneFixupPerCommit = true
AUTO-STAGE ALL CHANGES IF NOTHING STAGED
By default, git-absorb will only consider files that you’ve staged to the index via git add. However, sometimes one wants to try and absorb from all changes, which would require to stage them first via git add .. To avoid this extra step, set
[absorb]
autoStageIfNothingStaged = true
which tells git-absorb, when no changes are staged, to auto-stage them all, create fixup commits where possible, and unstage remaining changes from the index.
FIXUP TARGET ALWAYS SHA
By default, git-absorb will create fixup commits with their messages pointing to the target commit’s summary, and if there are duplicate summaries, will fall back to pointing to the target’s SHA. Instead, can always point to the target’s SHA via:
[absorb]
fixupTargetAlwaysSHA = true
GENERATE FIXUPS FOR COMMITS NOT AUTHORED BY YOU
By default, git-absorb will only generate fixup commits for commits that were authored by you. To always generate fixups for any author’s commits, edit your local or global .gitconfig and add the following section:
[absorb]
forceAuthor = true
GENERATE FIXUPS ON DETACHED HEAD
By default, git-absorb will not generate fixup commits when HEAD is not a branch ("is detached"). To always generate fixups on detached HEADs, edit your local or global .gitconfig and add the following section:
[absorb]
forceDetach = true
GENERATE SQUASH COMMITS INSTEAD OF FIXUPS
By default, git-absorb will generate fixup commits. To instead generate squash commits, edit your local or global .gitconfig and add the following section:
[absorb]
createSquashCommits = true
When this option is set, "fixup commit" may be read as "squash commit" throughout the documentation. All configuration relating to fixup commits will apply to the squash commits instead.
GITHUB PROJECT
AUTHOR
Stephen Jung <tummychow511@gmail.com>
| 02/14/2026 | git-absorb |