Subversion Branch/Trunk Best Practice - keeping Branch Up-to-Date?

后端 未结 5 1542
离开以前
离开以前 2021-01-31 10:12

My development team has worked with subversion for quite some time. The way that manage the trunk and branches is as follows:

  • We (almost) always release from t

相关标签:
5条回答
  • 2021-01-31 10:43

    So assuming I've got your model right here: You develop major changes to the project in a branch (off of trunk) which can get quite old.

    You continue to do other development on trunk which always holds the 'live' software, so these changes are minor updates and bug fixes. You're getting problems when you merge the monumental development branch back into trunk.

    You can only effectively manage 2 concurrent product versions with that model, which may be enough for now, but might bite you in other ways anyway and will get worse if you ever need to manage 3 or 4 versions. Can I suggest inverting the way you work?

    Have a Version branch for each release. This should be branched from trunk (at any revision). The only way you modify the version branch is to merge in revisions from trunk.

    This means you can work primarily on trunk instead of in a large development branch. You also apply your bug fixes directly to trunk - so you've got no major integration issues being stored up for the next release. To release bug fixes to the previous versions, just merge the required trunk revisions into the appropriate Version branch.

    This way you can keep everything you want to release in branch, but only actually ever release what you're happy with, because that's all you merge in to the version branch.

    You can still take development branches if you need, but you can keep them targetted and small, perhaps individual features rather than large projects.

    This will allow you to manage multiple versions in a sane way and keep a good track of what's in each release using svn's merge-info.

    0 讨论(0)
  • 2021-01-31 10:56

    Totally agree with Andy: There's no "one-size fits all solution", but the issue shouldn't be keeping your release branch up to date, rather the other way around.

    Good change control should keep your branch from being volatile. Gating issues should be fixed on the release branch and then merged to the trunk immediately. Be ready for this "merge" to be non-trivial, the release gating issue may not even exist on the trunk but you need to do an analysis and test for it anyawy.

    It sounds from what you say that you are developing on your branch and then merging all at once to your trunk just before you release and just crossing your fingers. I wonder how many bugs you are introducing by doing this.

    0 讨论(0)
  • 2021-01-31 10:58

    First, I wholeheartedly agree with the previous responders that there is no one-size fits all solution.

    In our case, we have many relatively small applications, with each application normally having only a single developer. When we do engage in collaborative development, there tends to be only 2 to 4 developers.

    Our general policy is:

    • The trunk contains the current project state;
    • We use branches for developing new features, bug fixes, etc. Branches are merged back to the trunk when complete;
    • To release, we create a tag from the current trunk and release the tag.

    Andy also made an important point that needs emphasizing: "Proactively teach people how to merge well." Many, if not most of our problems seem to arise from poor merging practices.

    0 讨论(0)
  • 2021-01-31 11:02

    Our experience is to clearly differentiate:

    • development branch
    • consolidation branch (branch used to consolidate development we are sure to go into production

    Trunk is only for recording stable released version, from which we can branch.

    In the "development branch", we can manage important changes, included some which will not end up in the next release (because too complex, not ready in time, dependent on other late developments, ...)

    The consolidation branch represents the final steps (note the plural) needed to finalize the release. It happens after a meeting where all the features needed to be delivered are validated.

    We only merge into the "consolidation branch" what we are sure to put into production. We go on that branch until the final release.

    0 讨论(0)
  • 2021-01-31 11:03

    Firstly, I don't think there's a one-size fits all solution when it comes to managing code branches and releases. But to touch on a few of your points from my perspective:

    • Yes, I would merge changes from trunk into the release branch more often. Smaller chunks are always going to be more manageable than one large integration. And of course this means you're working against the latest most stable code.

    • Proactively teach people how to merge well. The developer who made the change should be doing (or be closely involved with) the merge. Understand what it is you are taking and what it should look like when it is finished. I too often see people run a integration without really knowing what they are doing and what they are expecting as the result.

    • Perhaps you want to have an integration branch that isn't trunk. This can be tested daily and any issues caught here before they go and break trunk and scare everybody.

    0 讨论(0)
提交回复
热议问题