如果只有一个人在处理一个项目,您是否应该在 subversion 中使用分支?

发布于 2024-08-01 19:12:45 字数 360 浏览 10 评论 0原文

我刚刚开始在 C# 项目上使用 Subversion。 我独自完成这个项目,但我试图将自己视为在一个小组中工作以获取自己的学习经验。

据我了解,使用 subversion 的典型方法是拥有一个始终会构建的 trunk 文件夹。 然后在新分支中创建主要更改,然后在完成后将其合并回主干。 因此,不同的团队成员可能同时处理许多分支。

但如果我自己工作,建立一个分支还有什么意义吗? 假设我的 HEAD 版本已修订为 100。 我将在修订版 101 处创建一个分支,然后继续在该分支上工作,直到修订版 110。现在我可以将 110 合并回主干,但该项目中没有其他人,因此不会有任何更改要合并回的主干。 我只是将其合并回最初创建分支的修订版 100。

I'm just starting out using Subversion on a C# project. I am working on this project alone, yet I'm trying to treat is as if I was working in a group for my own learning experience.

As I understand it the typical way of working with subversion is to have a trunk folder that will always build. Major changes are then create in new branches, which are then merged back into the trunk when they are complete. So there may be many simultaneous branches being worked on by different team members.

But if I'm working on my own is there any point to making a branch? Say I'm at revision 100 in HEAD. I'll create a branch at revision 101, and then keep working on the branch until Revision 110. Now I can merge 110 back into the trunk, but there is no one else on the project so there won't be any change in the trunk to merge back into. I'd just be merging right back into revision 100 where I original created the branch.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

柠檬 2024-08-08 19:12:45

分支机构与有多少人参与一个项目无关。 分支用于替代开发流,例如不同的功能集、硬件目标或客户端。

如果 100 人正在处理一个可交付成果,他们应该使用同一个分支。 如果一个人支持十几个不同的可交付成果,他应该有十几个分支。

Branches have nothing to do with how many people are working on a project. A branch is for an alternate development stream, like different feature sets, hardware targets, or clients.

If 100 people are working on a single deliverable they should be using the same branch. If a single individual is supporting a dozen different deliverables he should have a dozen branches.

一身软味 2024-08-08 19:12:45

我认为分支应该总是在你需要将实际代码从基础中分离出来时使用,例如当你需要尝试一个牵强的解决方案来解决问题或其他问题时。 通过分支,您可以将问题和解决尝试分开并保持版本控制。

I think branches should be used always you need do split the actual code from the base, for example when you need to try a far fetched solution for a problem or something. With branches you can separate the problems and the attempts of resolution and keep the version control.

最冷一天 2024-08-08 19:12:45

分支(与标签相对)是代码的可维护版本。 即使作为一名开发人员,您也可能希望维护多个版本的代码(例如,将错误修复迁移到旧版本)。
SVN 书籍列出了 SVN 分支的两个最常见用例 这里
两种方法的分支策略都与项目中的开发人员数量没有直接关系。
除非您正在从事短期项目(例如学术、单一版本、项目),否则请尝试使用这些策略之一。 管理开销足够低,可以让您以后的生活变得更加轻松。

A branch (as opposed to tag) is a maintainable version of the code. Even as a single developer you may want to maintain more than one version of your code (e.g. migrating bugfixes to older releases).
SVN book lists the two most common use cases for SVN branches here.
Both methods' branching policies are not related directly to the number of developers in the project.
Unless you are working on a short term project (such as academic, single release, project) try to use one of these policies. The management overhead is low enough and it can make your life much easier later.

骄兵必败 2024-08-08 19:12:45

我保留 2 个分支:开发分支和主干分支,因为你永远不知道什么时候必须对生产进行快速修复。 在将新功能移植到生产环境之前,我可能会花 1-3 周的时间来研究新功能。 与此同时,我可能必须对生产进行修复。 通过保留 2 个分支,我可以轻松地仅部署错误修复。

I keep 2 branches: development and trunk because you never know when you have to do a quick fix on production. I may work on new features for 1-3 weeks before porting them to production. In the mean time, I may have to roll out fixes to production. By keeping 2 branches, I can easily deploy bug fixes only.

甚是思念 2024-08-08 19:12:45

如果只有您在处理该项目,那么创建分支似乎没有太多意义 - 毕竟您可以使用修订版本来回滚。

然而,如果您想做一些重大的实验性的事情,并想尝试一些事情,那么您可以使用分支来隔离您的更改并保留主干。

您可以像这样完全在主干之外工作,然后使用发布标签或分支用于历史目的......以及其他分支用于实验工作。

There doesn't seem too much point in creating branches if it's only you working on the project - you can just use the revisions after all to roll back to.

If, however you wanted to do something major and experimental and wanted to try a few things out then you could use the branch to isolate your changes and preserve the trunk.

You could work entirely out of trunk like this and then use release tags or branches for historical purposes... and other branches for experimental work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文