2012-02-21 106 views
1

改变我已经使用汞克隆获得的本地文件夹如何合并在水银

hg clone http://example.com/prj 

一个项目的工作副本我想修改一些文件,以满足我的需求。例如原始文件的样子:

int main() { 
    cout << "hello"; 
    return 0; 
} 

所以我改变这样的:

int main() { 
    int a = 0; 
    cout << "hello"; 
    return 0; 
} 

后来主库的变化,看起来像这样(与第一片段):

int main() { 
    for (int i=0; i<10; i++) 
     cout << "hello"; 
    return 0; 
} 

现在,当我运行

hg pull 
hg update 

我的更改int a=0;已丢失。

回答

3

对于如何分布的供应链管理工作的一个速成班,而且如何使用它们请阅读或者

或者:

实际上,它发生,如果你还记得hg commit进行了更改后。 你只会有2头的仓库,那你就需要hg merge例如:

$ hg pull 
pulling from /tmp/remote 
searching for changes 
adding changesets 
adding manifests 
adding file changes 
added 1 changesets with 1 changes to 1 files (+1 heads) 
(run 'hg heads' to see heads, 'hg merge' to merge) 
$ hg merge 
    int main() {   | int main() {   | int main() { 
     int a = 0;   |  for (int i=0; i<10 ;|  cout << "hello";  
     cout << "hello"; |   cout << "hello";| ------------------------ 
     return 0;   |  return 0;   |  return 0; 
    }      | }      | } 

要学习如何使用水银,请阅读online book

+0

你的意思是我要运行“汞承诺”就在“hg pull”之前? – mahmood 2012-02-21 07:54:30

+0

完成更改后,是的。 – Kimvais 2012-02-21 07:55:12

+0

对不起...你的意思是我必须运行1)hg commit,2)hg pull,3)hg merge,4)hg update? – mahmood 2012-02-21 07:56:26