LinuxCommandLibrary

git-absorb

Automatically create fixup commits for staged changes

TLDR

Absorb staged changes into matching commits

$ git absorb
copy
Absorb and automatically rebase
$ git absorb --and-rebase
copy
Dry run to see what would happen
$ git absorb --dry-run
copy
Specify base commit for the absorb stack
$ git absorb --base [HEAD~5]
copy
Force absorb skipping safety checks
$ git absorb --force
copy
Show verbose output
$ git absorb --verbose
copy

SYNOPSIS

git absorb [options]

DESCRIPTION

git-absorb automatically creates fixup! commits for staged changes, matching each hunk to the appropriate commit in your branch history. It is a port of Facebook's hg absorb tool for Mercurial.
The workflow is: stage changes with git add, run git absorb to create fixup commits, then either run git rebase -i --autosquash manually or use --and-rebase to do it automatically. By default, absorb searches within the last 10 commits.

PARAMETERS

-r, --and-rebase

Run git rebase --autosquash automatically after creating fixup commits.
-n, --dry-run
Show what would be done without making changes.
-b, --base commit
Use specified commit as base of the absorb stack.
-f, --force
Skip safety checks when creating fixup commits.
-v, --verbose
Display extra information during execution.
-w, --whole-file
Match changes to commits that last touched the file.
-h, --help
Print help information.
-V, --version
Print version information.

CONFIGURATION

~/.gitconfig

Configure `absorb.maxStack` to control how many commits absorb will search through (default: 10).

CAVEATS

Only considers staged changes (git index). Cannot absorb changes that span multiple original commits. New code (not modifying existing lines) cannot be absorbed. Safety checks may prevent absorption in some cases; use --force to override.

HISTORY

Git-absorb was created by Stephen Chung as a Rust port of Facebook's hg absorb command for Mercurial. It became popular in stacked diff workflows where maintaining clean commit history is essential.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community