Advice on converting to git from versioning-by-directory
From: Andy Parkins <hidden>
Date: 2016-08-11 19:53:41
Hello,
This is an overly long email, please don't waste your time unless you're
interested in git-based puzzles. I'm only really trying to solve the problem
for fun. (This is what I do for fun now? Oh dear).
I'm in the process of converting a colleague to using git for his project.
Previously it was stored in subversion - but was only really used as a backup
system, history is entirely linear and there are no merges and no branches.
Branching was effectively done by copying directories. So the history went
like this:
* version1/ created and worked on with regular commits
* version2/ created as a copy of version 1
* version2/ worked on with regular commits
* occasional commits in version1/
* version3/ created as a copy of version2/ and worked on
* version4/ created as a copy of version2/ and worked on
I simply converted the subversion repository to git and then used a bit of
rebase and cherry-pick work to put each commit in a particular directory in
its correct branch.
* -- * -- * -- * -- * version1
\
* -- * -- * version2
|\
| * -- * version3
\
* -- * version4
This is pretty good. It's certainly a huge improvement over what there was.
However, it's still not quite what I want. The problem is that I haven't
done any directory reorganising so now this is a mixed version-by-directory
and version-by-branch repository. For example the version4 branch, because
it came from version2, which came from version1 contains directories
version1/, version2/ and version4/.
This makes merging changes impossible, a bug fix in version1, when pulled into
version4 simply goes in version4's version1/ directory - obviously not what
would be wanted.
Phew; still with me? Obviously what I would like is to remove each
subdirectory, and have all the branching done using git. However, I'd like
to keep the history so far for each branch.
What should I do? I've thought of a number of things:
* Recreate the whole lot by hand, the repository isn't huge and I could
manually apply each commit as a patch in the correct place. It would be a
bit time-consuming but would mean I'd have what I wanted
* Keep the current history and move and remove files out of each branch to
make it look like I want it now, and allow history to be a bit of a mess.
* As I make each branch reorganise it early on, _then_ apply the history of
each branch to the right branch.
I'm tempted to go with recreate by hand, as that has the fewest compromises.
Before I did that though I thought I'd ask you clever chaps to see if you had
any amazing ideas :-)
Andy
--
Dr Andy Parkins, M Eng (hons), MIEE