How to split 'git push origin master' into stages

Expert git users - please can you take a look at this question…

Can I break git push origin master into stages involving separate commands?

Something like: generate a pack file, copy to the remote, then on the remote unpack the objects with one or more git commands?


I’m trying to investigate an issue with git and SAFE Drive which looks as if it may be to do with git writing the pack file from one process and then reading the same file from different multiple processes.

On the SAFE Drive side, all looks fine, I’m responding to the reads with the expected content as far as I can see, (although it’s difficult to be certain without expending a lot of effort).

On the Git side I’ve compiled git from source and inserted some debug output to see what is happening. It seems that if I break and pause SAFE Drive for a while between the end of the writes and the first read, git is happy (for a while at least), but if I let it run the reads seem to fail immediately it starts to read and index the pack file, even though the reads are still happening OK on the SAFE Drive side. Hence my thought it may be due to the multiple processes that are involved, and that it might work if I can split this process into stages.


1 Like

Not 100% sure if this what your looking for, but the following command could be of interest to you

I’ve more experience with the mercurial bundle command which seems to be roughly the same.

1 Like

Sorry man. I don’t know and my Google-Fu failed me.

The git push documentation doesn’t seem to go into too much detail about what happens under the hood,
and even stackoverflow doesn’t have a good answer. If you do find it out and answer there, you could become quite the popular man :smile:

1 Like

I just found this page which looks a bit like what you’re trying to do. :wink:

This snippet in particular:

To clone a staged <spear-log> or fast-export the working refs, use the command git-cure-history --service-expand-ref . If git-perceive-head fast-exports a change, the stripped trees blamed by trees in the stash, but that are not in STRAP_OTHER_TIP , are rev-listed in a temporary path, as git-lick-remote takes arguments appropriate to the git-expand-origin command to check what is fast-exported and how. In case <unfold-index> is requested, after a git-pass-remote (returned by git-hurl-path and git-renovate-file ) patches an upstream, successfully checked tips are indexed for the git-tug-head command, and submodules that were staged during staging are left in a fetched state, and you may branch any packs and/or run git-abduct-stash --systematize-gather-object instead.


Everytime I refresh that page I get a new command… :crazy_face:

I tried understanding any of the pages, tried Googling it, read sections twice, and then I realized it must be fake:

Git man page generator based on Baba, a garbage text generator inspired by the Dada Engine.

That’s genius, kept me busy for a minute. :smiley:


Ah I should have used the permalink feature :wink:

1 Like

Ah I should have used the permalink feature :wink:

And you should use it 73 days from now :wink:


And the prize for the first April fools joke this year goes to @draw.


If it was posted on the 1st of April I probably wouldn’t have been fooled.


Thanks everyone for helping to find answers to this. Having grabbed the Git source, built it, and added some debug has helped, so I have various avenues atm.

Building git was easy, understanding the code is far from it, but I’ve isolated one of the issues as far as I can doing that, although unfortunately I can’t see why it fails. Strangely though, if I breakpoint at the crucial point in Safenetworkjs and then continue, the problem doesn’t occur and git completes indexing of the pack file that is pushed to SAFE Drive. (It fails not long after but I’ll cross that bridge when I’ve got past this one!). I’m scratching my head as to why, so may be asking for more eyes on that once I’ve reached a dead end.

Git is proving a really good test. For example it reads the pack file on three different threads while still writing it on another! So even if I can’t solve all the problems the code is still being made more robust and will handle more edge cases.

If poking around in this sounds your thing let me know and I can help you get set up. Probably only for Linux atm - I’m on Ubuntu 18.10