如何删除多个头? [英] How to delete multiple heads?

查看:56
本文介绍了如何删除多个头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我错误地推送了一些文件,它在主存储库中显示了不同的头.我怎样才能删除那个头?

I have pushed some files by mistake and it shows different heads in main repository. How can I delete that head?

推荐答案

我不认为你真的想删除头像.如果这样做,您将丢失在这些分支中完成的工作.

I don't think that you actually want to delete the heads. If you do that, you will lose the work that was done in those branches.

您可能想将头部合并回一个分支.

You probably want to merge the heads back into one branch.

假设你有一棵这样的树:

Say that you have a tree like this:

o  4 : Head 1
|
o  3 : Another commit
|  
| o 2 : Head 2
| |
|/
o  1 : A commit
|
o  0 : Initial commit

要在不丢失其中包含的工作的情况下删除额外的头部,您可以像这样合并两个头部(本示例中的修订版 2 和 4):

To get rid of the additional head without losing the work contained within it you would merge the two heads (revisions 2 and 4 in this example) like this:

hg update 4
hg merge 2
hg commit -m "Merge"

这将创建另一个提交,其中包含修订版 2、3 和 4 中的所有更改,如下所示:

That will create another commit which has all the changes in revisions 2, 3 and 4 in a single head like this:

o     5: Merge
|\
o |   4 : Head 1
| |
o |   3 : Another commit
| | 
| o   2 : Head 2
| |
|/
o     1 : A commit
|
o     0 : Initial commit

当多个开发人员在同一个存储库上工作时,这是标准程序.

This is standard procedure when multiple developers work on the same repository.

这篇关于如何删除多个头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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