STG-REPAIR(1)
π STG-REPAIR π
okay so real talk bestie β this is stg-repair, and it lives in the StGit Manual. It's the "oops, my stack got weird" cleanup crew, and honestly it's kind of a lifesaver. π«Ά
β¨ SYNOPSIS β¨
stg repair [OPTIONS]
that's it. that's the whole invocation. no cap. π
π©Ή DESCRIPTION π©Ή
okay so picture this: you've got a branch with an StGit stack on it, and then somebody (maybe you, no judgement πΈ) goes and touches it with certain git commands β like git-commit(1), git-pull(1), git-merge(1), or git-rebase(1). and now the StGit stack metadata is not matching the branch state. inconsistent. messy. it's giving "my room after a laundry explosion." π
good news: you have a few options to resolve this kind of situation, bestie:
- Use
stg-undo(1)to undo the effect of thegitcommands. or, similarly, usestg-reset(1)to reset the stack/branch to any previous stack state. lowkey the "ctrl+z" route. β¨ - Use
stg repair. this one repairs the StGit stack metadata so it accommodates the modifications to the branch made by thegitcommands. specifically, it does the following:- If regular
gitcommits were made on top of the stack of StGit patches (i.e. by using plaingit commit),stg repairwill convert those commits to StGit patches, preserving their content. slay, your work is safe. π - However, merge commits cannot become patches. like, at all. so if a merge was committed on top of the stack,
stg repairwill mark all patches below the merge commit as unapplied, since they are no longer reachable. an alternative when this is not the desired behavior is to usestg undoto first get rid of the offending merge and then runstg repairagain. (yes, undo-then-repair. iconic two-step. π) - The applied patches are supposed to be precisely those that are reachable from the branch head. so if, for example,
git-reset(1)was used to move the head, some applied patches may no longer be reachable and some unapplied patches may have become reachable. in this case,stg repairwill correct the applied/unapplied state of such patches. vibe check passed. π¦
- If regular
stg repair will repair these inconsistencies reliably, so there are valid workflows where git commands are used followed by stg repair. for example, new patches can be created by first making commits with a graphical commit tool and then running stg repair to convert those commits into patches. literally that combo ate. π₯
bestie heads up: merge commits being unreachable-patch-city is the one thing that'll bite you β if the merge was a mistake, stg undo it away before repairing. π
π STGIT π
Part of the StGit suite β see stg(1) for the whole fam. π
and that's the page, mwah π β brought to you by StGit 2.7.0, dated 10/17/2026. go forth and repair, bestie. πΈπ«Ά
π¦ 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