How to reanimate a stack from another repository?

Skip to first unread message

Lawrence D'Anna

Sep 30, 2019, 4:10:04 PM9/30/19
Hello, stgit

The comments in say:

> A stack log is a git branch. Each commit contains the complete state
> of the stack at the moment it was written; the most recent commit has
> the most recent state.
> For a branch C{I{foo}}, the stack log is stored in C{I{foo}.stgit}.
> Each log entry makes sure to have proper references to everything it
> needs, which means that it is safe against garbage collection -- you
> can even pull it from one repository to another.

This sounds like a really compelling feature. It sounds like I should be able to
push my stack.stgit branch to say, my github account and be confident my full
stack history is backed up there. If I lose my computer or my local repo, I
should be able to recover not only the branch, but the stgit stack history as well.

It seems like all you need to do to recover to sync the branch and then

$ git config branch.stack.stgit.stackformatversion 3

Is that right? Even though it’s simple, it’s not exactly self explanatory. It seems like there
ought to be a command like “stg recover” or something like that that does this.

What do you think?

Peter Grayson

Sep 30, 2019, 10:06:52 PM9/30/19
to Lawrence D'Anna,
Hi Lawrence,

StGit currently maintains stack metadata in two places. One of the places is in the "foo.stgit" branch as indicated in The other is in files located in .git/patches/foo/. The former is the "new" location supported by the "new" internal git interface infrastructure. The latter is the location StGit originally used. Both are currently used. The metadata is redundant between the two locations. And StGit has separate git interface modules associated with each.

StGit still has a mix of commands using both the original and the new metadata infrastructure. Over the past year, I have been chipping away at converting commands still using the old metadata infrastructure to use the new. I have converted 7 commands. There are 6 more to go (branch, repair, import, mail, rename, sync).

Once all of stgit's commands are converted to the new infrastructure, then it will be possible to have first-class support for cloning, pushing, and pulling stgit metadata branches. I agree that StGit should probably grow some specific capabilities to help with this.

It sounds like perhaps you have discovered a trick to get stgit to rebuild the metadata in .git/patches/foo after cloning the foo.stgit branch from a remote repo. I believe this is possible since the foo.stgit branch contains all the information needed to reconstruct .git/patches/foo. The following seems to do the trick (but is emphatically *not* supported):

git clone foo
cd foo
git fetch origin master.stgit:master.stgit
stg init
stg undo

TL;DR: there is a long-standing vision to be able to do this and hopefully we will get there soon.

> --
> You received this message because you are subscribed to the Google
> Groups "StGit (Stacked Git)" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
> To view this discussion on the web, visit
Reply all
Reply to author
0 new messages