如何在Mercurial上git reset --hard HEAD? [英] How do I git reset --hard HEAD on Mercurial?

查看:74
本文介绍了如何在Mercurial上git reset --hard HEAD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是尝试使用Mercurial的Git用户.

I'm a Git user trying to use Mercurial.

这是发生的事情:我对要还原的变更集进行了hg backout.那创造了一个新的头,所以hg指示我进行合并(我想回到默认").合并后,它告诉我我仍然必须提交.然后,我注意到解决合并中的冲突时我做错了某些事情,并决定我想要拥有hg backout之前的所有内容,也就是说,我希望这种未提交的合并消失.在Git上,这些未提交的内容将包含在索引中,而我只需执行git reset --hard HEAD即可将其清除,但据我所读,该索引在Mercurial上不存在.那我该如何退出呢?

Here's what happened: I did a hg backout on a changeset I wanted to revert. That created a new head, so hg instructed me to merge (back to "default", I assume). After the merge, it told me I still had to commit. Then I noticed something I did wrong when resolving a conflict in the merge, and decided I wanted to have everything as before the hg backout, that is, I want this uncommited merge to go away. On Git this uncommited stuff would be in the index and I'd just do a git reset --hard HEAD to wipe it out but, from what I've read, the index doesn't exist on Mercurial. So how do I back out from this?

推荐答案

如果尚未提交,听起来好像还没有,可以使用hg update --clean撤消所有合并工作.

If you've not yet commited, and it sounds like you haven't you can undo all the merge work with hg update --clean.

但是,在较新的版本中,有一个方便的命令可以重新合并单个文件:hg resolve path/to/file.ext.从hg help resolve:

However, in newer mercurial's there's a handy command to re-merge a single file: hg resolve path/to/file.ext. From the hg help resolve:

The available actions are: ...

 4) discard your current attempt(s) at resolving conflicts and

重启 从头开始合并:"hg解析文件..."(或全部的"-a" 尚未解决的文件)

restart the merge from scratch: "hg resolve file..." (or "-a" for all unresolved files)

这篇关于如何在Mercurial上git reset --hard HEAD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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