stg-repair(1) — Linux manual page


STG-REPAIR(1)                 StGit Manual                 STG-REPAIR(1)

NAME         top

       stg-repair - Repair stack after branch is modified with git

SYNOPSIS         top

       stg repair [OPTIONS]

DESCRIPTION         top

       If a branch with a StGit stack is modified with certain git
       commands such as git-commit(1), git-pull(1), git-merge(1), or
       git-rebase(1), the StGit stack metadata will become inconsistent
       with the branch state. There are a few options for resolving this
       kind of situation:

        1. Use stg-undo(1) to undo the effect of the git commands. Or
           similarly use stg-reset(1) to reset the stack/branch to any
           previous stack state.

        2. Use stg repair. This will repair the StGit stack metadata to
           accommodate the modifications to the branch made by the git
           commands. Specifically, it will do the following:

           •   If regular git commits were made on top of the stack of
               StGit patches (i.e. by using plain git commit), stg
               repair will convert those commits to StGit patches,
               preserving their content.

           •   However, merge commits cannot become patches. So if a
               merge was committed on top of the stack, stg repair will
               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 use stg undo to
               first get rid of the offending merge and then run stg
               repair again.

           •   The applied patches are supposed to be precisely those
               that are reachable from the branch head. 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
               repair will correct the applied/unapplied state of such

       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.

STGIT         top

       Part of the StGit suite - see stg(1)

COLOPHON         top

       This page is part of the stgit (Stacked Git) project.
       Information about the project can be found at 
       ⟨⟩.  If you have a bug report for
       this manual page, see ⟨⟩.  This page
       was obtained from the project's upstream Git repository
       ⟨⟩ on 2023-12-22.  (At
       that time, the date of the most recent commit that was found in
       the repository was 2023-12-17.)  If you discover any rendering
       problems in this HTML version of the page, or you believe there
       is a better or more up-to-date source for the page, or you have
       corrections or improvements to the information in this COLOPHON
       (which is not part of the original manual page), send a mail to

StGit 2.4.1                    12/22/2023                  STG-REPAIR(1)

Pages that refer to this page: stg(1)