Multiple shared repositories (including svn) workflow
- From
- Luke Lu <git@vicaya.com>
- Date
- Jan 5, 2008, 08:54 UTC
- Message-ID
- <DA45FDDC-BEEB-47F6-A2B6-4FE4FFEF8B0D@vicaya.com>
We have an existing project using subversion. Half of the committers want to use git for its features and speed, another half (mostly editors, graphic designers etc.) want to continue use svn for the usual reasons -- advanced features of git doesn't really buy them much. They just want to work as usual, especially with the ease of TortoiseSVN (some swear by it). After some thought and experiment, I proposed the following workflow:
0. People who want to use svn can continue using svn as usual.
1. A maintainer uses git-svn to convert the subversion project into git:
git svn clone -s <project_url> project2. He then creates a bare git repo as the "current" or "official"
tree for the brave git users.
git clone --bare project project.git
project.git is then hosted on server, say, scm3. Git users clone the "current" repo
git clone git://scm/repos/project.git
and work merrily ever after.4. A maintainer (people or a cron job) would keep both official trees
synced:
a. He needs to add a git remote for the git-svn repo created at
step 1:
git remote add project ssh://scm/repos/project.git
b. To sync commits from git to svn:
git fetch && git rebase project/master
git svn rebase
git svn dcommit
c. To sync from svn to git:
git svn rebase
git rebase project/master
git push projectPreliminary tests showed that it seems to work well. Any problems that I didn't foresee?
Anyway, I've been using git for only a few months. There might/must be better ways to do it. As a user coming from cvs and svn, it seems to me that the most confusing command is actually "git pull" as it doesn't work with such workflow at all (conflicts with confusing messages, until you really understand the implications of rebase). It seems to me that if we create a new "git update" command which is essentially "git fetch && git rebase <remotebranch>", it would greatly alleviate such confusions. Some lessons learned from the short experience:
1. commit first, ask question later. 2. rebase is the new update 3. reset --hard and reflog are your friends.
Again, comments welcome.
__Luke