Hg(Mercurial):任何“搁置"的方式.以后的工作副本? [英] Hg (Mercurial): any way to "set aside" the working copy for later?

查看:76
本文介绍了Hg(Mercurial):任何“搁置"的方式.以后的工作副本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景:上一次提交后,您决定对代码库进行一些广泛的重构.一段时间之后,您意识到它花费的时间比预期的要长,您真的希望推迟重构一段时间,并执行更紧迫的任务.但是,您并不想失去到目前为止已经完成的所有重构工作.

Scenario: After your last commit, you decided to do some extensive refactoring of the codebase. After a time, you realize it is taking longer than expected, and you'd really rather put off the refactoring for another time, and work on more pressing tasks. But you don't want to lose all of the refactoring work you've done so far.

因此,有一种方法可以存档"或分支"工作副本(基本上,将其放在一边,但将其保留在存储库中以供以后访问),然后恢复到上次好的提交并从那里恢复,不用担心创建多个头或将两者混为一谈?

So, is there a way to "archive" or "branch" the working copy (essentially, set it aside but keep it in the repository for later access), and then revert to the last good commit and resume from there, without fear of creating multiple heads or getting the two mixed up?

推荐答案

不要担心怕两个头".两个脑袋是非常正常状态.这被称为匿名分支,这是人们在Mercurial中进行临时分支的方式之一.

Don't worry about "the fear of two heads". Two heads is a very normal state. It's called anonymous branches, and it's one of the ways people do temporary branches in Mercurial.

只需提交,然后更新为Tip-1,就可以开始了:

Just commit, and then update to tip-1 and you're ready to go:

hg commit -m "working on XXX"
hg update -r "tip-1"

然后离开.如果您想在该头上放一个书签(永久性比标签小的),可以,但是不必担心.

and away you go. If you want to drop a bookmark (less permanent than a tag) on that head you can, but there's no need to worry about it.

您始终可以使用hg push -r HEAD推一个头而不必推另一个头,其中甚至可以是hg push -r .

You can always push one head without pushing another using hg push -r HEAD where that can even be hg push -r .

别担心,它们正是使基于DAG的VCS功能强大的原因.

Don't fear heads -- they're what makes a DAG based VCS powerful.

这篇关于Hg(Mercurial):任何“搁置"的方式.以后的工作副本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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