svnbranching-and-merginggit-flowtrunk

Is it possible to use the git-flow model with Subversion?


We use Subversion and aside from a few individuals such as myself there is little to no experience with branching and merging in Subversion. My Subversion experience is limited to simple feature branches where merge and tree-conflicts, while not exactly rare, are not exceedingly difficult to resolve.

Given that, I am helping to manage a project where our current commit to trunk method is simply unsustainable for our needs. I introduced feature branching and merging to my localized team and we had some success. However simple feature branching was still not able to answer all our questions such as:

  1. How do we develop code in parallel for this release and subsequent releases?
  2. What code is considered stable?
  3. What (in development) code is going into the next release?
  4. What (in development) code is going into a subsequent release?
  5. What version of code is our Test, Acceptance, or Production environments?
  6. How do we integrate concurrent development activities with a known stable release to reduce introducing bugs and incomplete work?
  7. How do we provide hot-fixes to released code?
  8. How do we know, from our source control, what development activity is currently ongoing?
  9. How do we experiment or R&D without disrupting the current code base while leveraging?

It seems that git-flow as defined here would go a long way to answer a lot of these questions. I experimented with this method in Mercurial and it seems like that it is possible to implement this method there as well. Sadly, migrating to a DVCS is off the table at this point.

However, my brief attempt to mimic this method in Subversion failed with many merge and tree conflicts. The merge options and edge cases are numerous and baffling.

Can Subversion be used to implement git-flow and if so what is the pain level?


Solution

  • We use what is called the unstable trunk development method. This was the development methodology that the creators of Subversion had in mind when they created Subversion. It's simple and easy to implement.

    Here's an idea how it works:

    There will be some merging. It's mainly merging defects fixed on the release branch back to trunk. There are three options of doing this:

    You, of course, realize that this method takes something called planning. You must prioritize your work, so the developers do the work for the upcoming release before work on the future release. You only branch once you no longer have enough work on the upcoming release to keep all of your developers busy.

    You can implement the standard Git workflow which is using development separate development branches for each developer or issue, and then delivering those changes onto trunk. This would require a lot of branches, one for each developer/feature.

    You first merge from the trunk to the branch to rebase your code. Once you've done the rebase, you merge from the branch back to the trunk using the --reintegrate switch. Pre-1.6, you were suppose to delete the branch and recreate it since --reintegrate sort of messed up merge tracking. However, this has been fixed in Release 1.6.x and up.