TFS 中的搁架与工作区

发布于 2024-08-21 15:44:37 字数 633 浏览 9 评论 0原文

目前我正在开发一个使用 TFS 作为源代码控制的项目。我正在实现一项功能,但因需要外部资源完成的工作而受阻。由于功能尚未完全完成,我无法在不破坏构建的情况下检查更改。因此,我不想等待几天来完成阻塞工作,而是想解决一些缺陷。

为了与其他更改隔离地完成这项工作,我正在刚刚创建的第二个工作区中处理缺陷。

在使用第二个工作区隔离我的更改后,一位同事问我为什么不直接搁置我的更改。在阅读了一些有关搁架的内容后,看起来这对于像我这样的情况来说是首选解决方案。 我的问题是,在什么情况下(如果有的话)您会创建多个工作区以及在什么情况下应该使用搁置?有一些关于搁置,但我对工作空间的主题了解不多。

顺便说一句,我想到了创建第二个工作区 这里

Currently I am working on a project that uses TFS as source control. I am in the middle of implementing a piece of functionality, but am blocked by work that needs to be done by outside resources. Since the functionality is not fully complete, I can't check in the changes without breaking the build. So instead of waiting a couple days while the blocking work is finished, I want to work on some defects.

To do this work in isolation from my other changes, I am working the defects in a second workspace I just created.

After using a second workspace to isolate my changes, a coworker asked me why I didn't just shelve my changes. After doing some reading on shelving, it looks like this is preferred solution to situations like mine. My question is what situations, if any, would you create multiple workspaces and what situations should you use shelving? There are some posts about shelving, but I don't see very much on the subject of workspaces.

By the way, I got the idea for creating a second workspace here.

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

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

发布评论

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

评论(3

许久 2024-08-28 15:44:37

一个新的分支机构可能是最好的选择。但是,为了回答您的问题,搁置和仅使用不同的工作区之间的主要区别之一是,当您搁置时,会将代码推回 TFS,以便对其进行备份。您工作空间中的任何内容都与您计算机上的内容相同 - 如果您丢失了它,它就消失了。

我们在我的店里经常使用分支,因此,我没有看到货架有很多用途。

然而,我发现了一个对我非常有用的案例:
我经常在两台不同的开发机器之间切换(一台在办公室,一台在家里,通过 VPN 连接)。如果我正在做某件事,并且想将其从家里转移到工作场所,或者反之亦然,我经常使用架子。我可以从一台机器上搁置它,然后从另一台机器上取消搁置它。当我正在进行更改时,我会这样做,并且签入会破坏构建或以其他方式打断其他开发人员。

A new branch would probably be the best way to go. But, to answer your question, one of the key differences between shelving and just using a differnet workspace is that when you shelve, you push your code back to TFS, so it is backed up. Whatever is in your workspace is just what you have on your machine -- if you lose it, it's gone.

We use branching a lot in my shop, and as a result, I haven't seen many uses for shelving.

However, I have found one case where it has been very useful to me:
I often bounce between 2 different development machines (one at the office, one at home, connected via VPN). If I am working on something, and I want to transfer it from home to work, or vice-versa, I often use shelving. I can shelve it from one machine and un-shelve it from the other. I do this when I am in the middle of a change, and checking in would break the build or otherwise interrupt other developers.

笑红尘 2024-08-28 15:44:37

您在这里谈论的是两个完全不同的概念。当您搁置代码时,您会将其保存到 TFS,但不会将其检入任何特定分支。创建不同的工作区只需在您的开发计算机上设置一个新的本地文件夹并将文件保存在您的分支中。当您办理入住手续时,仍然可能会发生冲突。

为什么不创建一个新的代码分支。您可以在该分支上工作并签入,而无需执行其他任何人的更改,因为您正在签入您自己的代码分支。然后,当您完成更改并且其他人在主分支上完成更改时,您可以将更改合并到主分支中。

You are talking about two completely different concepts here. When you shelve code, you are saving it to TFS, but not checking it in to any particular branch. Creating a different workspace just sets up a new local folder on your development machines and saves the files in your branch there. When you do a check-in, you still could have conflicts.

Why not create a new branch of your code. You can work on that branch and check in without stepping on anyone else's changes, because you are checking in to your own branch of the code. Then, when you have completed your changes, and others have completed their's on the main branch, you can merge your changes into the main branch.

情何以堪。 2024-08-28 15:44:37

搁架是理想的选择。搁置允许您在常规构建之外的 TFS 中进行集体更改,并在以后按名称检索它们。多个工作空间并不是您正在做的事情的解决方案。如果您维护产品的不同版本并需要对其进行处理,那么多个工作区是很好的选择,例如,假设您有 4.0 和 5.0 产品,并且需要对这两个版本应用安全修复程序。当您想要进行更改但又不想立即提交时,搁置非常有用。

Shelving is the ideal option. Shelving allows you to make changes en masse in TFS outside the regular build, and retrieve them later by name. Multiple workspaces is not a solution for what you're doing. Multiple workspaces are good if you're maintaining different versions of a product and need to work on them, e.g. let's say you have a 4.0 and a 5.0 product and need to apply a security fix to both versions. Shelving is great when you want to make changes but not commit them immediately.

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