检索文件的旧版本而不更改工作副本父级
如何在 Mercurial 中获取文件早期版本的副本,而不将其作为工作区中文件的新默认工作副本?
我找到了 hg revert
命令,我认为它可以满足我的要求,但我不确定。
我需要获取代码早期版本的副本来使用几分钟。但我不想打扰当前运行良好的版本。
所以我打算这样做:
hg revert -r 10 myfile.pls
有没有办法将其输出到不同的目录,这样我当前的文件工作版本就不会受到干扰?像这样的东西:
hg revert -r 10 myfile.pls > c:\temp\dump\myfile_revision10.pls
How do you get a copy of an earlier revision of a file in Mercurial without making that the new default working copy of the file in your workspace?
I've found the hg revert
command and I think it does what I want but I'm not sure.
I need to get a copy of an earlier revision of my code to work with for a few minutes. But I don't want to disturb the current version which is working fine.
So I was going to do this:
hg revert -r 10 myfile.pls
Is there a way to output it to a different directory so my current working version of the file is not disturbed? Something like:
hg revert -r 10 myfile.pls > c:\temp\dump\myfile_revision10.pls
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
cat 命令 可用于检索文件的任何修订版本
: 将输出重定向到另一个文件
可以使用
--output
标志 。如果您需要对多个文件执行此操作,请查看 archive 命令< /a>,它可以对整个项目执行此操作,例如,这将创建文件夹
revision-10
,其中包含您的存储库的快照,如修订版 10 中所示。但是,大多数时候您应该只使用更新命令来签出早期版本。更新是在引入新更改后用于使工作副本保持最新的命令,但如果需要,该命令也可用于使工作副本过时。所以
The cat command can be used to retrieve any revision of a file:
You can redirect the output to another file with
or by using the
--output
flag. If you need to do this for several files, then take a look at the archive command, which can do this for an entire project, e.g.,This creates the folder
revision-10
which contains a snapshot of your repository as it looked in revision 10.However, most of the time you should just use the update command to checkout an earlier revision. Update is the command you use to bring the working copy up to date after pulling in new changes, but the command can also be used to make your working copy outdated if needed. So
您使用的命令是这样的:
了解一点 Unix 有助于使用 Mercurial 命令。也许
cat
应该有一个内置别名print
或类似的东西。The command you use is this:
Knowing a bit of Unix helps with Mercurial commands. Perhaps
cat
should have a built in aliasprint
or something similar.