版本控制系统->分支问题

发布于 2024-08-04 13:32:34 字数 314 浏览 6 评论 0原文

我正在处理下一个任务,突然意识到我需要与主管讨论一些细节才能继续。几天后我会见我的主管时会讨论这个问题。在那之前我需要完成另一项任务。

正确的做法是什么?

我看到 2 个选项:

1)将头修订版从存储库复制到新分支并在那里启动另一个任务。完成后 - 将其合并到主干。或者也许我需要先从主干合并到分支,然后再合并回主干?

2) 从工作副本复制到新分支。将主干恢复到最新版本(在开始我需要讨论的任务之前),切换到主干并处理另一个任务,然后在分支中完成当前任务并合并。

请详细解释正确的方法,因为我不是经验丰富的 VCS 用户。先感谢您。

I am working on the next task and suddenly understand that I need to discuss some details with my chief in order to continue. I will discuss it in a couple of days when I meed my chief. Until then I need to work on another task.

What is the correct way to do?

I see 2 options:

1) Copy head revision from repository to a new branch and start another task there. After I finish it - merge it to the trunk. Or maybe I will need to merge from trunk to the branch first, and then merge back to the trunk?

2) Copy from working copy to a new branch. Revert trunk to the last revision (before I started the task I need to discuss), switch to the trunk and work on another task, then finish my current task in the branch and merge.

Please, explain correct way in details, as I am not an experienced VCS user. Thank you in advance.

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

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

发布评论

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

评论(4

寄居者 2024-08-11 13:32:34

您面临的问题是您在主干上开始了更改,但想将其提交到其他地方。不幸的是,大多数版本控制系统没有内置的行为。在 SVN 中,最好的选择是:

  1. 在主干上创建一个新分支
  2. 执行 SVN 切换以将当前工作副本切换到该分支
  3. 您现在应该可以将本地更改并能够在新分支上提交它们
  4. 在将它们提交到分支,再次切换回主干
  5. 在主干上开发新功能
  6. 与主管讨论细节后,将它们从分支合并回主干

希望有帮助

The trouble your facing is that you started the changes on trunk but want to commit it somewhere else. Most version-control systems don't have a built in behavior for this, which is unfortunate. In SVN, your best bet is this:

  1. Create a new branch off trunk
  2. Do an SVN switch to switch your current working copy to that branch
  3. You should now your local changes and be able to commit them on the new branch
  4. After you commit them to the branch, do another switch back to trunk
  5. Work on the new feature on trunk
  6. After you discuss the details with your chief, merge them from the branch back to trunk

Hope that helps

熟人话多 2024-08-11 13:32:34

实际上,这两种选择都适合您,并且没有哪一种比另一种更正确。决定最简单行动方案的是合并更改所需的难度。一般来说,在 svn 中,如果可能的话,您希望避免合并。

通常这种决定取决于你的团队文化;如果您的同事通常不希望在主干中进行未完成/未批准的更改,那么将您的更改移动到分支,然后在您的主管批准您的代码后合并是有意义的。当然,如果您单独工作,那么一切都取决于您。

您确实有第三种选择,根据您的情况,它可能有效也可能无效,即同时处理主干中的两项任务,并分别提交各个更改。

Really both choices will work for you and neither is more correct than the other; what will determine the easiest course of action is the difficulty required to merge the changes. In general in svn you want to avoid merging, if possible.

Usually this kind of decision depends on your team culture; if your coworkers don't generally want unfinished/unapproved changes in the trunk then it makes sense to move your changes to the branch and then merge after your chief approves your code. Of course if you are working solo then it is all up to you.

You really have a third option that may or may not work depending on your situation, which is just to work on two tasks in the trunk at the same time, and commit the individual changes separately.

小忆控 2024-08-11 13:32:34

我会选择第一个选项,因为我可以保持后备箱清洁(始终工作)。因为你说的功能还需要你老板确认。如果该功能最终被丢弃,您的主干仍然不会受到影响,并且团队中的其他成员也不会对该更改感到困惑。

I will do the first option because I can keep my trunk clean (working at all time). Since the feature you are talking about still need to be confirmed by your boss. If the feature end up thrown away, you trunk will still be unaffected and other members in your team will not be confused with that changes.

零度° 2024-08-11 13:32:34

我们基于发布而不是任务进行分支。所以现在我们准备在几周内发布的所有内容都在分支 5.1.1 中。当更改发布到生产环境时,这些更改将合并回主干。

We branch based on release not task. So right now everything we are getting ready to release in a few weeks is in branch 5.1.1. The changes are merged back to trunk when they are published to production.

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