2012-02-21 100 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