简体   繁体   中英

How to reintegrate branch, overwriting trunk changes that has not been merged into branch?

We have worked on a feature branch the last six months. Most commits made to the trunk in this period have been merget to the branch, but some trunk commits were deliberately never merged to the branch.

Now the branch is complete, and we basically want to "replace" trunk with the branch (we do not need the trunk changes that was never merged to the branch anymore). This answer to a simular question suggests :

  1. Check out the trunk revision from which you created the branch (not the HEAD revision).
  2. Commit it to the repository (this undoes all subsequent trunk changes).
  3. Do your reintegrate-merge (your trunk working copy should now be identical to the branch.)
  4. Commit the merged trunk, and you're done!

This answer suggests :

svn co http://svnhost/trunk
cd trunk
svn merge http://svnhost/trunk http://svnhost/branches/branchname

What will be the proper solution in my case?

If you really want to replace your trunk, then you could you use the Repository Browser (TortoiseSVN) and do the following:

  • Delete the trunk
  • Use "Copy To" to copy your branch to the "trunk" location
  • Delete the branch

You could also move the branch to the repository root and rename it to "trunk".

If you are using externals that point to your current trunk, you might have a problem if you did not use the "peg" revision when referencing the trunk. If you do not use externals, you should be fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM