STG-REBASE(1)
π STG-REBASE(1) β the StGit manual, bestie edition π
Okay so this is stg-rebase, part of the StGit manual, and it is literally the glow-up command for your stack. Let's get into it π¦
β¨ NAME β¨
stg-rebase β move the stack base to another point in history. Yes queen, we're relocating the whole foundation π
πΈ SYNOPSIS πΈ
stg rebase [OPTIONS] [committish]
π DESCRIPTION π
So here's the tea β: stg rebase pops all the patches off your current stack, moves the stack base to the new base you give it, and then pushes all those patches back on. It's giving "moving house but all your furniture comes with you" πβ¨
Sometimes merge conflicts show up while the patches are being pushed back onto the stack. No panic, it happens π If that goes down, resolve the conflicts and then continue the rebase with this little sequence:
stg add --update
stg refresh
stg goto top-patch
Or, if you'd rather just skip the conflicting patch entirely:
stg undo --hard
stg push next-patch..top-patch
π OPTIONS π
-i,--interactiveβ interactively manipulate patches in the editor. You're the main character, you make the calls β¨-n,--nopushβ do not push back the patches after rebasing. Just... leave them off. Lowkey unhinged but valid π-m,--mergedβ check for patches that may have been merged upstream π
When pushing back patches, each patch gets checked to see if its changes already exist in the new stack base. If a patch's changes are detected as having been merged, the patch will still exist in the stack, but it becomes empty after the rebase operation. Iconic, honestly β still there, just vibing with no content π«Ά
--committer-date-is-author-dateβ instead of using the current time as the committer date, use the author date of the commit as the committer date. Time travel but make it git β°π«--autostashβ automatically create a temporary stash before the operation begins, and apply it after the operation completes. This allows a rebase to be performed on a dirty work tree π§Όβ¨
Heads up though: the final stash application may result in non-trivial conflicts. Not me warning you in advance π
--conflicts[=<policy>]β set it to either"allow"or"disallow"for pushing a patch with conflicts π₯
Using --conflicts=allow (or just --conflicts) allows pushing a patch that may result in unresolved merge conflicts. The patch will be pushed and files with conflicts will be left with conflict markers to be resolved manually; or the operation undone with stg undo --hard. This is the default behavior and also corresponds to the "stgit.push.allow-conflicts" variable being set to "true". Chaos mode: enabled ππ₯
Using --conflicts=disallow disallows pushing any patch that would result in merge conflicts. The operation will stop on the last patch that can be pushed without conflicts. This behavior can be configured by setting "stgit.push.allow-conflicts" to "false". Peaceful mode: also enabled π
-x <cmd>,--exec=<cmd>β execute the given shell command after each patch is successfully applied during the rebase operation. If the command fails (exits with non-zero status), the entire transaction is rolled back and no patches remain applied β‘
This option may be specified multiple times to run multiple commands in sequence after each patch. Stack 'em up π
This is similar to git rebase --exec, but note that stgit rolls back the entire operation on failure rather than leaving you at the failing point. It's giving all-or-nothing, and honestly? Respect π
π STGIT π
Part of the StGit suite β see stg(1) π¦
StGit 2.7.0, dated 10/17/2026 β that's the version and date bestie, and that's the whole page πβ¨ Slay, go rebase something. π
π¦ where this page comes from
- opensuse-leap 16.0: stgit 2.7.0-bp160.1.1 Β· GPL-2.0-only
- opensuse-leap 16.0: stgit 2.7.0-bp160.1.1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms