如何恢复/撤消 TFS 中未更改的文件?
我想知道是否有一个有用的命令可以撤消 TFS 中未更改的文件。
我尝试过使用“tfpt uu”命令。但它只会撤消/恢复服务器和本地工作区中未更改的文件。例如。所有在服务器上更改但在工作区中未触及的文件都将保留为签出状态。我想要的是恢复/撤消工作区中未更改的所有文件。 tfpt uu 命令似乎对这种情况没有用。
我如何在 TFS 中恢复/撤消未更改的文件,其中未更改文件的定义是工作区中未更改的文件。
示例:
我有两个工作区 ws1 和 ws2。 Ws2 用于模拟其他用户在 TFS 中进行源更改,ws1 代表我自己的工作区。我们有 3 个文件 A、B 和 C。
- 检出 ws1 上的所有文件。 (A、B、C已检出)
- 在ws2中更改文件A。
- 将文件 A 签入 ws2 中。
- 更改 ws1 中的文件 B。
- 在 ws1 上执行 tfpt uu。
唯一恢复/撤消的文件是 C。文件 A 和 B 仍在 ws1 中签出。
我预计 A 和 C 都已恢复/撤消,因为它们在 ws1 中尚未更改。
I would like to know if there is a usefull command for undoing unchanged files in TFS.
I have tried with the "tfpt uu" command. But it only undoes/reverts the files that was unchanged on the server and in my local workspace. Eg. all the files that was changed on the server but wasn't touched in the workspace is left as checked out. What I want is to revert/undo all the files that was unchanged in my workspace. The tfpt uu-command seems to be useless for the scenario.
How can i revert/undo unchanged files in TFS, where the definiton of an unchanged file is a file that was not changed in the workspace.
Example:
I have two workspaces ws1 and ws2. Ws2 is for simulating an other user making source changes in TFS and ws1 represents my own workspace. We have 3 files A, B and C.
- Checkout all files on ws1. (A, B and C are checked out)
- Change file A in ws2.
- Check In file A in ws2.
- Change file B in ws1.
- Execute tfpt uu on ws1.
The only file reverted/undone is C. The files A and B are still checked out in ws1
I would expect that both A and C where reverted/undone, since they have not been changed in ws1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
在
tfpt uu
上指定/noget
选项,我想您会得到您想要的行为。Specify the
/noget
option ontfpt uu
, and I think you will get the behavior you are after.听起来您需要合并/解析对文件 A 的更改,然后 tfpt uu 才能识别该文件未更改。由于文件 A 已检出,TFS 希望您在更新本地副本之前解析该文件。因此 tfpt 无法识别该文件未更改,因为它与(最新)服务器版本不同。
It sounds like you need to merge/resolve the changes to file A before tfpt uu will recognize that the file is unchanged. Since file A is checked out, TFS expects you to resolve the file before it updates your local copy. So tfpt doesn't recognize that the file has not changed, because it is not the same as the (latest) server version.
这个问题很老了,但这可能会有所帮助:假设工作区中的所有文件都指向相同的变更集,您不妨与您的工作版本进行比较:
首先,获取您的工作版本:
然后撤消所有未更改的文件(假设之前的文件)命令返回 123456 作为您的工作版本):
The question is old, but this might help: assuming all your files in your workspace are pointing to the same changeset, you might as well compare agains your working version:
First, get your working version:
Then undo all unchanged files (assuming the previous command returned 123456 as your working version):
我遇到了类似的情况,我对代码进行了分支,然后重命名了分支,当我将它们合并在一起时,由于重命名(物理路径已更改),每个文件都有一个“更改”。
我尝试了 2 个选项:
由于这两种方法都不适合我,所以我厌倦了寻找,但我想也许这些选择之一对其他人也适用。
I ran into a similar situation where I had branched my code, then renamed the branch, and when I went to merge them back together, every file had a "change" because of the rename (physical path changed).
I tried 2 options:
Since neither of these worked for me, I got tired of looking, but thought maybe one of these options would work for someone else.
相关:文件上的创建/修改日期属性似乎使
tfpt uu
不起作用,因为我手动将文件从一个分支的本地目录复制/粘贴到另一个分支的本地目录,并且它拒绝撤消任何操作,即使只修改了几个文件。就我而言,修改时间戳是相同的,但创建时间戳相差 10 分钟,因为这显然是我将两个分支下载到本地开发计算机所花费的时间。
Relevant: Date Created/Modified attribute on files appears to make
tfpt uu
not work, because I manually copy/pasted files from one branch's local directory to another and it refuses to undo anything, even though only a few files have been modified.In my case, the modification timestamps are the same, but the creation timestamps are off by 10 minutes because that's how long it apparently took me to download the two branches to my local development machine.