在多个开发人员之间使用 Trunk / Branches 和 Tag 结构

发布于 2024-10-10 02:53:14 字数 688 浏览 6 评论 0原文

当谈到主干/分支和标签时,我最终感到困惑。以下是我的查询:

我们有一个开发团队致力于一个项目。开发人员通常分成几组,他们在同一项目的不同模块上工作。

目前,我们有一个简单的 SVN 系统(没有任何主干/分支或标签),每个人都在同一台本地服务器上工作并提交文件。但当几个开发人员开发未来的模块(不应该立即上线)时,问题就开始了。在这种情况下,他们无法提交数据,因为如果他们这样做,他们的开发代码将上传到实时服务器上,最终会弄乱一切。

所以,现在我正在寻找某种解决方案,这些开发人员可以单独工作,但使用相同的代码。像这样的事情:

开发人员 A 正在开发新模块 A 开发人员 B 正在开发新模块 B 开发人员 C 正在修复模块 C 的错误(该模块已经上线,但需要修复很少的错误),

因此,开发人员 A 将在这台计算机上拥有自己的副本,并将提交到开发人员 A 的存储库。 (或分支)

相同的逻辑适用于开发人员 B,但开发人员 C 将开发一个公共稳定副本,该副本将位于标签中的某个位置,一旦工作完成,它将被标记并推送到主干,以便在实时服务器上上传。

开发人员 A 完成工作后,会将所有文件推送到 Trunk 进行实时上传。 (这也应该合并主干中的一些常见文件)。同样的逻辑也适用于开发人员 B。

我不确定 SVN 是否是正确的解决方案。我什至不知道是否有更简单的方法来实现我想要的。

欢迎任何建议。

谢谢 总温度

I end up getting confused when it comes to Trunk / Branches and Tags. Following is my query:

We have a team of developers working on a single project. The developers are often divided in groups and they work on various modules on the same project.

Currently, we have a simple SVN system (without any Trunk / Branches or Tags) where everyone works on the same local server and commits the files. But the problem starts when, a couple of developers work on future modules (which are not supposed to go live immediately). In this situation, they cannot commit the data because if they do, their development code will be uploaded on the live server and it will end up messing up everything.

So, now I am looking for some kind of solution where, these developers can work separately but on the same code. Something like this:

Developer A is working on New Module A
Developer B is working on New Module B
Developer C is working on Bug Fixes of Module C (which is already on live but few bugs needs to be fixed)

So, Developer A will have it's own copy on this machine and will commit to Developer A's repository. (Or Branch)

The same logic applies to Developer B but Developer C will be working on a common stable copy which will be somewhere in Tags and once the work is done, it will be tagged and pushed to the Trunk for the upload on live server.

Once Developer A is done with the work, he will push all his files to Trunk for live upload. (This should merge some common files in trunk too). Same logic applies to Developer B.

I am not sure if SVN will be the right solution for this or not. I don't even know if there is any simpler way to implement what I want.

Any kind of suggestions are welcome.

Thanks
TTR

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

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

发布评论

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

评论(2

单身狗的梦 2024-10-17 02:53:14

我的观点首先是,如果你所有的开发人员都在项目的不同部分工作,那么你可以取消分支。这可能需要一些组织(例如适当的日志注释和版本控制),但这比分支和合并要少得多。

好的,但如果你确实想要分支,那很容易。有几种方法可以实现这一点,但基本上所有方法都涉及最终代码结束的“主”版本。这可以是主干,或者有些人喜欢在主干上进行更改,然后合并代码以发布分支。不过,“后备箱是主人”是最容易掌握的概念。

在 svn 中,创建一个分支很容易 - 它是一个廉价的副本,所以你唯一的问题是用东西填充一个目录(我建议在完成后删除一个分支)。 SVN 也为此类工作提供了一种特殊的分支 - 重新整合分支。它很特别,因为 SVN 会跟踪它发生的情况,它的设计是从主干创建一个分支,对其进行处理,偶尔使用对主干所做的更改来更新它,然后将该分支上的所有工作重新集成到主干中最后一声巨响。然后你就可以重新开始了。听起来这可能就是您想要的 - 但通常情况下,您不会为每个开发人员创建一个分支,而是为每个工作包创建一个分支。

每个开发分支的问题在于,随着分支的寿命越来越长,它们所做的更改将越来越难合并回来。如果开发人员不定期将其他开发人员的工作合并到他们的分支中(正如他们习惯的那样),情况尤其如此。

由于 svn 提供廉价副本,我可能会建议为每个开发人员分支整个主干。我发现更容易记住,而不是分支单个目录,并且您始终能够更改共享或公共文件,而不必担心提交它们是否会破坏不同的分支。 (即,如果您分支 /trunk/moduleA 然后发现需要更改 /trunk/include/common_file 那么当您分支子集时,公共文件将不会在您的分支中。所以只需在根分支,因为这不会'不会花费你任何额外费用)

my opinion firstly is that if all your devs are working on separate pieces of the project, then you can do away with branches. It may take a little organisation (eg proper log comments and versioning) but that can be a lot less hassle than branching and merging.

Ok, but if you do want branches, they're easy. There are several approaches to this, but basically all involve a 'master' version where the final code ends up. this can be trunk, or some people prefer to make changes on trunk and then merge the code to release branches. The 'trunk is master' is the easiest concept to grasp though.

In svn, making a branch is easy - its a cheap copy so your only problem is filling up a directory with the things (I recommend deleting a branch once you're done with it). SVN gives you a special kind of branch for this type of work too - the reintegration branch. It is special as SVN tracks what happens to it, its designed that you create a branch from trunk, work on it, occasionally updating it with changes that have been made to trunk, and then reintegrate all your work on that branch into trunk in one final bang. Then you can start all over again. It sounds like this could be what you want - typically though, you wouldn't have a branch per developer, you'd have a branch for each package of work.

The trouble with per-dev branches is that as a branch lives longer and longer, the changes they make will be harder and harder to merge back. This is especially true if the developers do not merge the other dev's work into their branches regularly (as they are wont to do).

As svn does cheap copies, I would probably recommend branching the entire trunk for each developer. I find that its easier to remember that instead of branching individual directories, and you'll always be able to change shared or common files without having to worry if committing them will break a different branch. (ie if you branch /trunk/moduleA and later find you need to change /trunk/include/common_file then the common file will not be in your branch as you branched a sub-set. So just branch at the root as that doesn't cost you any extra)

少跟Wǒ拽 2024-10-17 02:53:14

在您的问题中,您刚刚表达了整个主干/标签/分支模型背后的基本原因 - 它是为了准确管理这种情况,这是开发商店不久后进入的正常情况。

需要计划的一件事是从无行李箱模型迁移到行李箱模型。

你说你没有任何主干、标签、分支等。所以我假设你的模型看起来像这样:

/
 filea.html
 fileb.html
 dira/
  filex

警告 - 不要尝试在其自身下分支根目录

例如:

svn cp / /branchA

这将导致一个看起来像这样的目录:

/
 filea.html
 fileb.html
 dira/
  filex
 branchA/
  ...
 branchB/
  ...

取消选取根分支和子分支的一部分很快就会变得非常棘手。

保持干净——首先将所有代码移入主干。这是一种结构跳跃,需要每个人(以及所有部署系统)删除他们的工作区并从 clean 中获取所有内容:

svn cp / /trunk

现在你可以创建你的分支:

svn cp /trunk /branches/branchA

给你一个如下的结构:

/
 trunk/
  filea.html
  fileb.html
  dira/
   filex
 branches/
  branchA/
   ...

一旦分支已经创建,开发人员可以检查它们并对其进行处理。您的部署系统可以指向 trunk/ 而不是根文件夹并进行部署。

任何致力于错误修复的开发人员都可以检查 trunk。当他们提交时,部署系统将像现在一样部署他们的更改。

当branchA完成后,开发人员可以将更改合并到主干中,就像gbjbaanb建议的那样。

只是快速提醒一下,祝你好运。

In your question, you've just expressed the basic reason behind the whole trunk/tags/branches model - it's for managing exactly this situation, which is a normal situation for a development shop to get into after a short while.

One thing to plan is your migration from a trunkless model to a trunk model.

You say you don't have any trunk, tags, branches, etc. So I assume your model looks something like this:

/
 filea.html
 fileb.html
 dira/
  filex

A word of warning - don't try to branch the root directory under itself.

eg:

svn cp / /branchA

This would result in a directory that looks like:

/
 filea.html
 fileb.html
 dira/
  filex
 branchA/
  ...
 branchB/
  ...

Unpicking what's a part of the root branch and the sub-branches becomes pretty intractable pretty quickly.

Keep it clean - move all the code into trunk first. This is the kind of structural jump that will require everyone (and all your deployment systems) to delete their workspaces and get everything from clean:

svn cp / /trunk

Now you can make your branches:

svn cp /trunk /branches/branchA

Giving you a structure like:

/
 trunk/
  filea.html
  fileb.html
  dira/
   filex
 branches/
  branchA/
   ...

Once the branches have been made, the dev's can check them out and work on them. Your deployment system can point to trunk/ instead of the root folder and deploy that.

Any devs working on bug-fixes can checkout trunk. When they commit, the deployment system will deploy their changes just as they do now.

When branchA is finished, the devs can merge the changes into trunk just as gbjbaanb suggests.

Just a quick heads up, good luck with it.

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