如何在 Visual Studio TFS 中回滚?

发布于 2024-08-21 23:52:01 字数 287 浏览 5 评论 0原文

我正在开发一个使用 VSTS 2008 的大型项目的一个子模块。

我需要将该模块回滚到早期版本(之前大约有 4 次签入)。我尝试在 Visual Studio UI 中执行此操作,最终意识到没有回滚选项。

经过一番研究,我确定有一个强大的工具下载,声称支持通过命令行进行回滚工具。然而,似乎几乎没有相关的文档。

谁能一步一步描述如何在 VS2008 中回滚到以前的版本? (使用电动工具或其他方式)。

额外问题——有人知道我们是否可以在 VS2010 中获得更强大的回滚支持吗?

I'm working on one sub-module of a large project for which is use VSTS 2008.

I have a need to rollback the module to an earlier version (about 4 check-ins previous). I tried to do this in the Visual Studio UI, and finally realized there is no option to rollback.

After some research, I determined there is a power tools download that purports to support rollback via a command-line tool. However, there appears to be virtually no documentation for it.

Can anyone describe step by step how to rollback to a previous version in VS2008? (Using Power Tools or otherwise).

Bonus question--anyone know if we might get more robust rollback support in VS2010?

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

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

发布评论

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

评论(7

一桥轻雨一伞开 2024-08-28 23:52:01

右键单击源代码管理资源管理器中的文件夹。选择获取特定版本。选择您想要获取的版本(按变更集、日期、标签等)。

编辑:此时您的本地版本将是您想要的版本。签出更改的文件,然后将它们重新签入。这将打开合并向导,它可能会抱怨服务器的版本比您的版本更新。通过向导并按照您想要的方式合并文件(其中一个选项是放弃服务器更改,这听起来就是您想要的)。在此过程结束时,它可能会告诉您由于合并过程(或类似性质的过程)没有签入任何文件,只需单击“确定”,然后再次签入。这应该可以完成你所需要的。

Right-click on the folder in Source Control Explorer. Choose Get Specific Version. Choose the version that you want to get (by changeset, date, label, etc).

EDIT: At this point your local version will be the version that you want. Check out the changed files and then check them back in. This will bring up the merge wizard and it will probably be complaining about how the server has a newer version than you do. Go through the wizard and merge the files the way you want them (one of the options is to discard the server changes, which is what it sounds like you want). At the end of this process, it may tell you that no files were checked in due to the merge process (or something of that nature), just hit OK and then check in again. This should accomplish what you need.

够钟 2024-08-28 23:52:01

幸运的是,这在 TFS 2012 中变得更加容易。现在 GUI 中有一个回滚选项。

MSDN 提供了有关如何执行此操作以及哪些选项的详细信息可用。
以下是来自 MSDN 的有关如何回滚到特定版本的文本:

要回滚到特定版本:

  1. 在源代码管理资源管理器中,选择一个项目,打开其快捷菜单,然后选择“回滚”。
  2. 在“回滚”对话框中,选择“回滚到特定版本”。

当然,您也可以回滚整个变更集或变更集的集合。如果您愿意,您还可以轻松回滚到特定时间点。

This has luckily been made much easier in TFS 2012. Now there is a Rollback option from the GUI.

MSDN has more information on how to do it, and what options are available.
Here is the text from MSDN on how to rollback to a specific version:

To roll back to a specific version:

  1. In Source Control Explorer, select an item, open its shortcut menu, and choose Rollback.
  2. In the Rollback dialog box, select Rollback to a specific version.

You can of course also rollback entire changesets or a collection of changesets. And you can also easily rollback to a specific point in time if you wish.

葬花如无物 2024-08-28 23:52:01

有一种方法,但我觉得不太好..打开 Visual Studio 命令提示符并..

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tf rollback -?
TF - Team Foundation Version Control Tool, Version 10.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Rolls back the changes in a single or a range of changesets:
tf rollback /changeset:changesetfrom~changesetto [itemspec] [/recursive]
            [/lock:none|checkin|checkout] [/version:versionspec]
            [/keepmergehistory] [/noprompt] [/login:username,[password]]

tf rollback /toversion:versionspec itemspec [/recursive]
            [/lock:none|checkin|checkout] [/version:versionspec]
            [/keepmergehistory] [/noprompt] [/login:username,[password]]

Versionspec:
    Date/Time         D"any .Net Framework-supported format"
                      or any of the date formats of the local machine
    Changeset number  Cnnnnnn
    Label             Llabelname
    Latest version    T
    Workspace         Wworkspacename;workspaceowner

There IS a way but I don't find it pretty.. Open Visual Studio command prompt and ..

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tf rollback -?
TF - Team Foundation Version Control Tool, Version 10.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Rolls back the changes in a single or a range of changesets:
tf rollback /changeset:changesetfrom~changesetto [itemspec] [/recursive]
            [/lock:none|checkin|checkout] [/version:versionspec]
            [/keepmergehistory] [/noprompt] [/login:username,[password]]

tf rollback /toversion:versionspec itemspec [/recursive]
            [/lock:none|checkin|checkout] [/version:versionspec]
            [/keepmergehistory] [/noprompt] [/login:username,[password]]

Versionspec:
    Date/Time         D"any .Net Framework-supported format"
                      or any of the date formats of the local machine
    Changeset number  Cnnnnnn
    Label             Llabelname
    Latest version    T
    Workspace         Wworkspacename;workspaceowner
忘东忘西忘不掉你 2024-08-28 23:52:01

2011 年 8 月 TFS Power Tools 在 Visual Studio 2010 UI 中添加了完整的回滚支持。

下载链接:http://visualstudiogallery.msdn.microsoft.com/c255a1e4- 04ba-4f68-8f4e-cd473d6b971f

TFS 2012 中也包含此函数。

The August 2011 TFS Power Tools added full rollback support right into the Visual Studio 2010 UI.

Download link: http://visualstudiogallery.msdn.microsoft.com/c255a1e4-04ba-4f68-8f4e-cd473d6b971f

This function is also included with TFS 2012.

梦忆晨望 2024-08-28 23:52:01

<块引用>

额外问题——有人知道我们是否可以在 VS2010 中获得更强大的回滚支持吗?

是的。与直接针对现有 2008 客户端 API 进行编码的 Power Tools 不同,TFS 2010 具有用于直接在服务器上执行回滚的新 API。这使得它们更快、更可靠,同时添加了 2008 年根本无法实现的功能,例如恢复合并历史记录。

Bonus question--anyone know if we might get more robust rollback support in VS2010?

Yes. Unlike the Power Tools, which is coded directly against the existing 2008 client API, TFS 2010 has a new API for executing rollbacks directly on the server. This makes them far faster and more reliable, while adding functionality that wasn't possible at all in 2008 such as reverting merge history.

ㄟ。诗瑗 2024-08-28 23:52:01

来自 MSDN 文章如何:回滚更改集( VS2008虽然也有其他版本)

恢复到早期版本
文件

  1. 在源代码管理资源管理器中,右键单击要删除的文件
    回滚,然后单击“获取特定”
    版本。将出现“获取”对话框。
  2. 在“类型”下,点击“变更集”。
  3. 在变更集下,点击省略号 (...)。
  4. 在“查找变更集”对话框中,使用默认值或
    指定您的搜索条件,以及
    然后单击“查找”。
  5. 在“结果”下,单击包含您要升级到的版本的变更集
    想要恢复文件,然后
    单击“确定”。
  6. 在“获取”对话框中,选择“覆盖不可写的文件”
    选中复选框,然后单击
    得到。该文件的早期版本
    被复制到您的本地工作
    文件夹。
  7. 在源代码管理资源管理器中,右键单击该文件,然后单击
    签出进行编辑。
  8. 在“签出”对话框中,单击“签出”。
  9. 在源代码管理资源管理器中,再次右键单击该文件,然后
    单击“签入待处理的更改”。
  10. 在“签入 - 源文件”对话框中,单击文件,然后
    单击“签入”。解决冲突
    出现对话框,并显示一条消息
    解释说没有文件
    签入是因为两个版本
    有冲突的更改。
  11. 在消息框中,单击“确定”。待定更改 - 冲突窗口
    出现。
  12. (可选)在“待更改”窗口的工具栏中,单击“比较”
    本地到服务器。服务器和本地
    副本并排显示,以便您
    可以在您之前审查您的决定
    回滚更改
  13. 在“待处理的更改”窗口中,点击“保留本地版本”。
  14. 在源代码管理资源管理器中,右键单击该文件,然后单击
    签入待处理的更改。
  15. 在“签入 - 源文件”对话框中,单击“签入”。

From the MSDN article How to: Roll Back a Changeset (VS2008 although other versions are available)

To revert to an earlier version of a
file

  1. In Source Control Explorer, right-click the file that you want to
    roll back, and then click Get specific
    version. The Get dialog box appears.
  2. Under Type, click Changeset.
  3. Under Changeset, click the ellipses (…).
  4. In the Find Changesets dialog box, either use the default values or
    specify criteria for your search, and
    then click Find.
  5. Under Results, click the changeset that contains the version to which you
    want to revert the file, and then
    click OK.
  6. In the Get dialog box, select the Overwrite writable files that are not
    checked out check box, and then click
    Get. The earlier version of the file
    is copied to your local working
    folder.
  7. In Source Control Explorer, right-click the file, and then click
    Check Out for Edit.
  8. In the Check Out dialog box, click Check Out.
  9. In Source Control Explorer, right-click the file again, and then
    click Check In Pending Changes.
  10. In the Check In - Source Files dialog box, click the file, and then
    click Check in. The Resolve Conflicts
    dialog box appears, and a message
    explains that no files have been
    checked in because the two versions
    have changes that conflict.
  11. In the message box, click OK. The Pending Changes – Conflicts window
    appears.
  12. (Optional) In the toolbar of the Pending Changes window, click Compare
    Local to Server. The server and local
    copies appear side by side so that you
    can review your decision before you
    roll back the changes
  13. In the Pending Changes window, click Keep Local Version.
  14. In Source Control Explorer, right-click the file, and then click
    Check In Pending Changes.
  15. In the Check In - Source Files dialog box, click Check in.
捂风挽笑 2024-08-28 23:52:01

Visual Studio 2013 中,这变得更加容易。要回滚,请执行以下操作:

  1. 源代码管理资源管理器中,选择解决方案/项目
  2. 右键单击​​,然后选择“查看历史记录”
  3. 在历史记录视图中,选择您要更改的变更集想要回滚
  4. 右键单击​​,然后选择查看变更集详细信息。这将打开团队资源管理器。
  5. 在团队资源管理器中,单击“回滚”
    Team Explorer
  6. 要使回滚永久生效,您需要立即签入。或者您可以对回滚版本进行更改,然后签入。

In Visual Studio 2013 this became an easier task. To Rollback, do the following:

  1. In Source Control Explorer, select the solution/project
  2. Right-click, then select "View History"
  3. In the history view, select the changeset you want to roll back
  4. Right-click, then select View changeset details. This opens up the Team Explorer.
  5. In the Team Explorer, click "Rollback":
    Team Explorer
  6. To make the rollback permanent, you need to check in now. Or you can make changes to the rolled back version and then check in.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文