2011-11-03 43 views

回答

26

對於未提交的更改可以使用Shelve extension

  1. hg shelve --all
  2. hg up correct_branch_name
  3. hg unshelve
+1

我的hg版本(3.7.3)似乎沒有使用'--all'標誌。簡單地叫'hg shelve'擱置一切。 – ForeverWintr

9

我問在IRC

MPM說

我曾經考慮過,但我一直在試圖避免
hg diff > mychanges; hg up -C somewhere; hg import --no-commit mychanges 

D70說

i think you can easily do it by "hg update"ing to a changeset that is a 
parent of the branch you're trying to switch to, and then "hg update"ing to the 
tip of that branch 

,所以我做到了。

hg up -r <shared root rev> 
hg up branchIwant 

我問「爲什麼」,並被告知「你不允許跨分支更新」,這對我來說一開始沒有任何意義。然後我意識到,因爲我經歷了共享的root rev,它並沒有跨越分支機構。

+0

酷!萬分感謝!這是將我的更改提交到另一個已有分支的最簡單方法:) –

0

我通常使用

hg qnew 
hg qpop 
hg up -c <target-rev> 
hg qpush 
hg qfinish qtip 

但我也使用jrwren的通過祖先相當經常去的方法。

相關問題