在 Subversion 中用分支替换主干 [英] Replacing trunk with branch in Subversion
问题描述
假设人们一直在研究主干和 Subversion 存储库的一个分支.我想放弃主干上的任何更改,并将其替换为分支的副本.
Let's say people have been working on the trunk and on a branch of a Subversion repository. I want to discard any changes on the trunk, and replace it with a copy of the branch.
正如另一个问题中所建议的,我可以移动或移除后备箱,然后将分支复制到主干.但随后主干的历史被分支的历史取代.如果我想保留主干的历史记录怎么办?
As suggested in another question, I can just move or remove the trunk, and then copy the branch over to the trunk. But then the trunk's history is replaced with the branch's history. What if I want to retain the trunk's history?
我认为我想要的是合并之类的东西,但是忽略目的地的更改,而只是用源替换.我将如何在 Subversion 中执行此操作?这被认为是好的做法吗?
I think what I want is something like a merge, but one where the destination's changes are ignored, and just replaced with the source. How would I do this in Subversion? Is this considered good practice?
推荐答案
虽然它是一个很老的线程,但仍然分享我的经验
我们最近为我们的一个项目执行了此操作,并遵循以下准则:
We recently did this for one of our projects and followed guidelines as:
svn copy <repos/trunk> <repos/tag/old_trunk> -m "copied old trunk as tag"
svn delete <repos/trunk> -m "deleted trunk temporarily"
svn copy <repos/branch/new_fetaure_branch> <repos/trunk> -m "placed new trunk with features"
按照这些步骤保持主干历史完整,并将新功能分支替换为主干.
Following these steps kept the trunk history intact and replace the new feature branch as trunk.
这篇关于在 Subversion 中用分支替换主干的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!