While I use git for all of my projects, occasionally, I have to collaborate with colleagues who don’t use git. They prefer to email their zipped sources back and forth. It’s annoying and cumbersome, but I have to deal with it. The workflow is as follows:
When they need my code, I use git archive
and send them a Zip file export.zip
. I continue to work and commit the changes I do, while they work with my outdated sources. Illustration:
┌ archive & mail
│
A ← B ← C
└───┴── my later changes
Some time later, they send me their response file import.zip
. What’s the best way to import the Zip file into my git tree and how to implement it? I can think of the following three options, which differ semantically:
Consider my later changes based on their changes:
┌ archive & mail
│
A ← A' ← B ← C
│ └───┴── my later changes
│
└─ their changes
Here I would checkout A
, unzip import.zip
, commit as A'
and then reapply B
and C
(and whatever followed). How do I reapply commits up to HEAD
?
Consider their changes based on my later changes:
A ← B ← C ← A'
Here I would create a patch based on the diff between A
and import.zip
and apply that to C
.
Create a branch and merge:
A ← B ← C ← M
↖ ↙
A'
While writing this question, I came to the conclusion that this option is the most generally applicable and the most robust. Do you agree?
I’m grateful for other advice regarding that workflow as well. For example, I find it tedious and error-prone to remember the commit A
that I archived.
You are correct, #3 is the best. I would create a branch for each person who might send you changes. Checkout their branch, unzip the archive, and commit the changes into their branch. At some point you can merge your changes together with their changes, and git will point out conflicts for you, which is obviously not optimal but relatively OK considering you're dealing with folks mailing zips around. When you are ready to send them your most recent changes, I would recommend tagging the commit that you are archiving as "collab-zip-<date>
" or something, with a tag message that says "Sending changes to X because Y". That answers your last bit about how to keep track of what you sent, when.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With