重命名文件并用 Subversion 中先前版本的文件替换旧文件名
我在 Windows 中使用 TortoiseSVN 检查了一个 Subversion 分支。我有一个文件,将其命名为 myfile.txt,我想将其重命名为 mynewfile.txt。然而,我想保留 myfile.txt,并将其恢复到以前的版本,例如 r15。因此,我希望 myfile.txt 具有来自 r15 的内容,并且 mynewfile.txt 具有来自 rHEAD 的 myfile.txt 内容。我希望我能用 Subversion 命令以某种方式做到这一点,以便保留文件的历史记录。这样,当我提交此内容并且您查看修改时,您可以看到 mynewfile.txt 只是 myfile.txt 的重命名,并且 myfile.txt 现在具有 r15 中的旧内容。这可能吗?我应该重命名 myfile.txt -> mynewfile.txt 然后重新制作 myfile.txt,手动将内容从 r15 复制到其中?
I have a Subversion branch checked out using TortoiseSVN in Windows. I have a file, call it myfile.txt, that I want to rename, say to mynewfile.txt. I want to keep myfile.txt around, however, and just revert it back to a previous revision, say r15. So, I want myfile.txt to have content from r15 and mynewfile.txt to have myfile.txt's content from rHEAD. I was hoping I could somehow do this with Subversion commands so that the history of the file is preserved. That way, when I commit this and you look at the modifications, you can see mynewfile.txt is just a rename of myfile.txt, and myfile.txt now has its old content from r15. Is this possible? Should I just rename myfile.txt -> mynewfile.txt and then remake myfile.txt, manually copying content from r15 into it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信这会如你所愿地保留历史。
编辑:TortoiseSVN,没有意识到!新步骤:
mynewfile.txt
作为新名称。I believe that would preserve the history as you wish.
EDIT: TortoiseSVN, did not realize! New steps:
mynewfile.txt
as the new name.您需要旧版本的第二个工作副本(复制目录并仅更新单个文件就足够了)。然后需要执行以下步骤:
rename
重命名文件svn copy versioned items here
(确保旧文件的文本状态显示“已替换(+)”,并且“已添加(+ )”为新文件)You need a second working copy at the old revision(It is sufficient to copy the directory and update the single file only). Then you need to perform the following steps:
rename
from the svn context menu to rename the filesvn copy versioned items here
from the appearing menu