Updating the trunk from my branch at regular intervals
I am working on a long term branch. I want to update the trunk with the stuff in my branch every week or so.
I had been updating my branch from trunk using merge a range of revisions.
I then used reintegrate a branch to merge my branch back into trunk.
Then I went back to my branch and did merge a range of revisions a开发者_开发知识库nd I got a ton of tree conflicts....
What is the proper way to do this? (keep trunk updated from another branch and keep that branch updated with trunk)
You should only keep your branch upto date with trunk. Then when you are ready to push your branch mods back into trunk it will only take the changes from your branch. Don't try to keep them both in sync with each other as you go along, you'll just get tied up in knots
If you start to hack on a particular feature that no one has and you don't share it with trunk or any other tree this might be a good procedure:
- create a branch
- hack, hack, hack and commit to your branch
- when ready to merge with trunk, merge trunk changes to your branch
- resolve conflicts, commit to branch
- merge cleanly with trunk
If you don't merge changes in any time of branch development to trunk you can merge trunk more often to peacefully resolve conflict or design issues. Subversion remembers what you previously have merged.
It depends on how your organization use branches. Here's what ours does:
For development branches - how I believe you're using branches in your question - I agree with Pete's answer here (and +1 to him). Don't try to merge both ways throughout your project. Throughout your project, keep the branch updated with merges from the trunk to the branch. Once your project is done, merge your branch down to the trunk (after testing!!!), and be done with the branch.
For release branches, we use merges a couple of ways:
- Trunk -> branch: Initial integration - create the release branch. And generally, this is the only time we merge in this direction with release branches.
- Branch -> trunk: If bugs are found in production, we fix on the branch and then merge back to the trunk. This happens until the next release branch is cut.
What's important is that your organization have a policy and adhere to it. Don't do things ad-hoc.
HTH,
-aj
精彩评论