如何回滚到 Mercurial 中已提交和推送的修订?
我犯了一个错误并删除了一个文件。我想回到之前的承诺! 我尝试了恢复和退出,但没有运气......
有什么建议吗?
编辑:我正是这样做的:
hg forget file hg commit -m "Blah" hg push
最后一次推送的修订号是 17。
现在不再跟踪文件。我想将其恢复到修订版 15(不是之前的修订版,而是后退一步),因为我不想继续处理修订版 16 中的文件。
I made a mistake and removed a file. I'd like to go back to my previous commit!
I tried with revert and backout with had no luck...
Any tip?
Edit: I did exactly this:
hg forget file hg commit -m "Blah" hg push
The revision number of this last push is 17.
Now file is not tracked anymore. I'd like to get it back to revision 15 (not the inmediate previous rev, but one extra step back) as i do not want to keep working on the file in rev 16.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
找到了解决办法:
Found a solution:
如果您已提交,则可以更新到以前的版本。如果文件受版本控制,它就不会消失。这就是版本控制的用途。
如果您删除了文件但尚未提交,则只需执行更新即可恢复该文件。
[编辑:基于编辑的问题]
If you have committed then you could update to previous version. If the file is version controlled, it is not going to go away. Thats what version control are for.
If you have removed a file and had not committed, then simply do the update and it will restore the file.
[edit: based on edited question]
尝试拉取版本 15 和
hg pull -r
,然后添加文件。Try pulling version 15 and
hg pull -r
and then adding the file.