使用TortoiseSVN进行分支和合并的最简单方法是什么? [英] What is the simplest way to do branching and merging using TortoiseSVN?

查看:83
本文介绍了使用TortoiseSVN进行分支和合并的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用TortoiseSVN进行分支和合并的真正简单的方法是什么?

What is a really simple "how to" to do branching and merging using TortoiseSVN?

推荐答案

假设您的工作目录为在主干中工作:

Assuming your work directory is working from the trunk:

右键单击根工作文件夹(此术语始终指Windows资源管理器),然后执行 svn update 将您的工作文件夹更新到最新的主干。

Right-click on the "root work folder" (this term always refers to Windows Explorer) and do svn update to update your work folder to the latest trunk.

请确保您的文件稳定。

右键单击根工作文件夹,然后执行 svn commit 以确保将任何本地更改都提交给了主干。

Right-click on the root work folder and do svn commit to make sure any local changes are committed to the trunk.

右键单击根工作文件夹,然后执行 svn回购浏览器

Right-click on the root work folder and do svn repo-browser.

如果您在存储库中还没有分支文件夹:右键单击中继文件夹上方的文件夹,然后执行创建文件夹并创建分支文件夹(例如,如果您的中继是 http :// myserver / svn / MyRepository / MyProj / Trunk ,创建 http:// myserver / svn / MyRepository / MyProj / Branches

If you don't already have a branches folder in the repository: right-click on the folder just above the trunk folder and do "create folder" and create a branches folder (for example, if your trunk is http://myserver/svn/MyRepository/MyProj/Trunk, create http://myserver/svn/MyRepository/MyProj/Branches).

右键单击主干文件夹,然后执行复制到:并为您的新文件夹输入名称科。例如: http:// myserver / svn / MyRepository / MyProj / Branches / MyNewBranch 。 (不必担心这会浪费很多空间...这被称为便宜的副本 ...它实际上不会复制文件的内容,除非它们发生更改。)

Right-click on the trunk folder and do Copy To: and put in the new folder name for your branch. For example: http://myserver/svn/MyRepository/MyProj/Branches/MyNewBranch. (Don't worry that this will waste a lot of space... this is called a "cheap copy" ... it doesn't actually copy the contents of files unless they change).

关闭回购浏览器。

右键单击工作文件夹的根目录,然后执行: svn开关,然后选择新分支的文件夹名称(例如, http:// myserver / svn / MyRepository / MyProj / Branches / MyNewBranch )。将其他所有内容保留为默认设置。

Right click your work folder root, and do: svn switch and choose the folder name of your new branch (for example, http://myserver/svn/MyRepository/MyProj/Branches/MyNewBranch). Leave everything else at the default.

现在在您的分支机构上工作。当您到达里程碑时,右键单击根工作文件夹,然后执行 svn commit 提交到您的分支。 (这不会在主干中看到。)

Now work on your branch. When you get to milestones, right-click on the root work folder and do svn commit to commit to your branch. (This will not be seen in the trunk).

如果其他人在同一分支上工作,则定期进行 svn更新从根工作文件夹。这将从分支更新。 (它将不会从主干获得任何更新。)

If others are working on the same branch, periodically do svn update from the root work folder. This will update from the branch. (It will NOT get any updates from the trunk.)

无论其他人是否在同一分支上工作,都应定期合并主干中的更改以确保您的分支以后集成起来不会太难。要进行定期合并,请执行以下操作:右键单击工作文件夹的根目录,然后执行 svn合并。选择合并修订范围。在要从其合并的URL下,选择中继(例如, http:// myserver / svn / MyRepository / MyProj / Trunk )。将修订范围留空,然后将其他所有内容保留下来。点击下一步。保留所有内容,然后单击合并。确保一切正常,如果没有,请修复。满意后,请从工作根文件夹进行定期的 svn更新从分支进行更新(即使您是唯一在分支上工作的人,这也是必要的,满足SVN)。然后执行 svn commit 来将合并的中继更改提交到分支。您可以根据需要定期重复执行此步骤多次。

Whether or not others are working on the same branch, you should periodically merge changes from the trunk to make sure your branch won't be too hard to integrate later. To do the periodic merge: right-click on the work folder root and do svn merge. Select "Merge a Range of Revisions". Under "URL to merge from", choose the trunk (for example, http://myserver/svn/MyRepository/MyProj/Trunk). Leave Revision Range blank and leave everything else alone. Click Next. Leave everything alone and click Merge. Make sure everything still works... fix it if not. Once you are satisfied, do a regular svn update from the work root folder to update from the branch (this is necessary even if you are the only one working on the branch, to satisfy SVN). Then do svn commit to commit the merged trunk changes to the branch. You can repeat this step periodically as many times as you want.

分支机构准备好集成后,请最后一次执行上述步骤并进行最终测试。对分支进行最后的提交。

Once your branch is ready to integrate, do the above step one last time and do your final testing. Do a final commit to the branch.

右键单击您的根工作文件夹,然后执行另一个 svn开关,时间切换到中继(例如, http:// myserver / svn / MyRepository / MyProj / Trunk )。这实际上具有撤消您在分支机构上完成的所有工作的效果,但是请不要担心...您将把工作取回。 (它还会报告对分支中未更改的文件的大量更新,但这只是 SVN属性的更改……不必担心。)

Right click on your root work folder and do another svn switch, this time switching to the trunk (for example, http://myserver/svn/MyRepository/MyProj/Trunk). This will have the effect of essentially "undoing" all the work you've done on your branch, but don't worry... you will get your work back. (It will also report a lot of updates to files you didn't change in your branch, but these are just "SVN property" changes... don't worry about them.)

右键单击您的工作文件夹,然后执行 svn合并。这次,选择重新集成分支。对于URL,将其放在分支中(例如, http:// myserver / svn / MyRepository / MyProj / Branches / MyNewBranch )。剩下的都不要动,然后单击下一步。保留所有内容,然后单击合并。现在,您已经拥有分支机构已完成的所有工作,以及树干上的最新工作。

Right click on your work folder and do svn merge. This time, choose "Reintegrate a Branch". For the URL, put in your branch (for example, http://myserver/svn/MyRepository/MyProj/Branches/MyNewBranch). Leave the rest alone and click Next. Leave everything alone and click Merge. You now have all the work you've done on your branch, as well as up-to-date work from the trunk.

进行最终测试。一切都应该正常进行,因为这应该与分支上一次测试中的文件集相同。右键单击您的根工作文件夹,然后执行 svn commit 。提交所有内容,甚至包括您分支中未使用的文件(它们只是具有 SVN属性更改,但是提交它们有助于SVN跟踪所有修订)。

Do a final test. Everything should work because this should be the same set of files you had in your last test in the branch. Right-click on your root work folder and do an svn commit. Commit everything, even files that you didn't work on in your branch (they just have "SVN property" changes but committing them helps SVN keep track of all the revisions).

现在,主干可以完成所有分支工作以及在分支上工作时在主干中完成的所有工作,并且所有工作都可以进行。此外,SVN具有所有文件的完整历史记录,甚至包括您在分支机构工作时签入的修订版本。

The trunk now has all your branch work as well as all the work that was done in the trunk while you were working on your branch, and it all works. In addition, SVN has the complete history of all the files, even the revisions that were checked in while you were working on your branch.

可选:进入Repo-browser ,右键单击您的分支文件夹(例如 http:// myserver / svn / MyRepository / MyProj / Branches / MyNewBranch ),然后执行删除。这不会影响中继,您也不再需要分支。 (即使您真的很偏执,也不必担心,因为如果您确实需要,甚至可以随时从Repo浏览器找回已删除的分支。)

Optional: go into Repo-browser, right-click on your branch folder (for example, http://myserver/svn/MyRepository/MyProj/Branches/MyNewBranch) and do "delete". This will have no effect on the trunk, and you don't need the branch any more. (Even if you are really paranoid, don't worry, because you can even get your deleted branch back from Repo browser at any time if you really need to.)

请随时发表评论!

这篇关于使用TortoiseSVN进行分支和合并的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆