I have two rooms in which I maintain some source code using git, a "dev" room where most development happens and a "deploy" room in which we actually use the software. Inevitably some changes happen in the deploy room as well. I'd like both rooms to share the same history in git.
Restrictions:
- For security reasons the two rooms are not network connected.
- Only text files (human readable) can leave the deploy room.
Moving changes into the deploy room is simple using git bundle
, and tracking the last commit we moved into the deploy room. Moving changes out of the room is more difficult due to the text-only restriction.
Goal: Move commits back and forth between my two unconnected rooms as if a git pull
had happened, i.e., identical SHA1 hashes in both rooms.
So Far:
I've tried
git format-patch
to move changes from deploy back to dev, but this doesn't record merges, and therefore requires a different patch set to be generated for each contiguous set of changes along with some record of how to reproduce the exact merge commit which happened in between. There is some discussion about making diffs for merge commits, but this doesn't seem to capture the actual ancestry, only the changes. It seems that patches may not be a rich enough format to provide the necessary information.Some bundle-to-text script could be used to convert the bundle into non-zipped and human-readable(ish) format, (and then back again after downloading) but I have found no evidence that such a script exists.
Perhaps a script could be written to walk the history from some common ancestor to the newest commit and either a) make a patch or b) recreate the merge of some commonly-known refs.
Fallback: I could always squash the commits coming out of the deploy room into just one raw patch and break the history, but then further downloads from dev->deploy would break any existing working copies. Not ideal.
Update:
I believe git fast-export
may do what I need, although most examples have it working on entire repositories and not partial histories like git bundle
. I have a working toy example in which I can export a partial history into an out-of-date clone, but it requires me to hand-edit the fast-export output so that I add a from <sha1>
to the first commit. Without this modification the import creates different sha1s and then complains with Not updating refs/heads/master (new tip <hash> does not contain <master's hash>)
.
Update2:
My git fast-export
solution does work, but it has a bandwidth problem, since it works by providing entirely new files rather than diffs from previous files. This is not acceptable since I actually have to read all those extra lines.