如何从 svn 检出特定文件? [英] How can I checkout a specific file from svn?

查看:38
本文介绍了如何从 svn 检出特定文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要精神错乱了.

我正在为我的博士学位编写代码.项目.我有两个版本的特定 .cpp 文件,我想同时使用它们(在它们之间交替使用).我想保留其他文件的最新版本.

I'm writing code for my Ph.D. project(s). I have two versions of a specific .cpp file and I want to use them both (alternating between them). I want to keep the most updated version of the other files.

我尝试使用 svn copy 但它不会覆盖现有文件.我试图删除该文件,但 svn copy 只会说它不会覆盖存储库中存在的文件,即使它们在目标文件夹中丢失.除了将整个版本检出到单独的目录并将文件手动复制到所需的文件夹之外,如何将本地文件夹中的单个文件恢复到以前的版本?

I tried using svn copy but it won't run over existing file. I tried to delete the file but svn copy will just, kindly, say that it won't write over files existing in the repository even if they are missing in the target folder. Apart from checking out the entire version to a separate directory and copying the file manually to the desired folder, how can I revert a single file in my local folder to a previous version?

我不想更新整个树,只想更新本地副本.

I don't want to update the entire tree, simply the local copy.

或者,是否有其他版本控制系统可以在 ssh 上工作并为我提供此功能?

Alternatively, is there other version control system that can work over ssh and will give me this feature?

谢谢

推荐答案

前言

手册中:svn help update+svn help cat+svn help diff 可以成为你最好的朋友.读取命令说明、-r 选项的含义、TARGET-URL 或 PATH 的格式

Preface

In the manual: svn help update+svn help cat+svn help diff can be your best friends. Read commands descriptions, meaning of -r option, format of TARGET-URL or PATH

如果您想在两个版本的文件之间切换并且不要并行使用,您可以使用单个 WorkingCopy 并仅更改其中所需文件的版本.

If you want to switch between two versions of file and do not use in parallel, you can use single WorkingCopy and change only version of needed file in it.

操作方法:

  • 提交-提交-提交.记住 firstsecond 需要的 file.cpp 版本的修订版(让它们是 N 和 M,我们将命名为 HEAD.repo 的最后一个修订版.N < M < HEAD)
  • 内部工作副本(完全更新到 HEAD) - 返回到单个文件 file.cpp 的修订版 N:svn up -r N file.cpp,切换到 M:svn up -r M file.cpp,获取最新的,HEAD:svn up file.cpp
  • 如果您只想查看不同版本的文件,不使用,您可以cat文件的任何修订版(与WC 中的修订)或 diff 在单个文件的两个修订之间(可能使 WC 不受这些命令的影响)
  • Commit-commit-commit. Remember revisions of first and second needed version of file.cpp (let they be N and M, last revision of repo we will name HEAD. N < M < HEAD)
  • Inside working copy (fully updated to HEAD) - return to revision N for single file file.cpp: svn up -r N file.cpp, switch to M: svn up -r M file.cpp, get most recent, HEAD: svn up file.cpp
  • If you want only to see at different versions of file, not use, you can cat any revision of file (not related to revision in WC) or diff between two revisions of single file (may leave WC untouched by these commands)

示例:

来自我的 WC,简短的 up 示例

from my WC, short up example

>svn up -r 1687 dcmode.htm
Updating 'dcmode.htm':
U    dcmode.htm
Updated to revision 1687.

>svn up dcmode.htm
Updating 'dcmode.htm':
U    dcmode.htm
Updated to revision 8734.

这篇关于如何从 svn 检出特定文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆