顯然,我已經檢查的最後幾個星期的提交到一個分支。除了對一個文件的更改外,我想將所有內容都提交給主幹。我該怎麼辦?水銀/ HG:得到改變出的分支,進入主幹
3
A
回答
5
當你談論命名分支與水銀你在談論一個變更的永久屬性。變更集不能位於不同的分支上,仍然是相同的變更集。你可以(如@馬特球)認爲分支的結果合併到默認:
hg update default
hg merge thebranchname
或者你也可以的,瘋狂的,歷史的破壞扭曲經過假裝這些變化的一個分支沒有完成(如@Rudi詳情(抱歉))。
只是現在就合併,並考慮在將來考慮使用書籤,匿名分支或單獨的克隆,因爲您無法立即推送 - 無法在變更集上創建永久註釋。
1
如果您沒有推出新分支的任何變更集,並且在分支中沒有合併,則可以使用mq擴展名將中繼線不需要的變更集移動到分支尖端。
$EDITOR ~/.hgrc
[extensions]
mq =
«save+quit»
# import all revisions up to the unwanted rev into a patch queue
hg qimport -r$BRANCH_TIP_REVISION:$IN_TRUNK_UNWANTED_REVISION
# edit the order of the patches, so that the unwanted patch is the last patch
$EDITOR .hg/patches/series
«Move the in trunk unwanted patch to the last line of the file»
# Variant 1: don't change the branch
hg qpush -a # apply all patches
hg qfinish -a # finish all patches to regular hg changesets
hg log -l2 # find out the revision number of the latest revision you want in trunk
hg up -r trunk # checkout trunk
hg merge -r $LATEST_WANTED_REVISION_NUMBER # merge only the wanted changesets
# Variant 2: *All* patches are on the new branch, and
# you want only the differing changeset on the new branch
hg up -r trunk # move the working copy to trunk
hg qpush -a # apply all patches
hg qpop # unapply the unwanted one
hg qfinish # finish the applied patches
hg branch $OLD_BRANCH_NAME # switch the working copy to the new branch
# if there is already another branch of this name,
# you need to checkout the other branch, apply the
# patch and merge trunk into that branch afterwards.
hg qpush # apply the branch-specific patch
hg qfinish -a # finish the patch
+0
這很有趣,包括MQ解決方案如何總是複雜的,多步驟的過程中結束了:) –
+1
由於汞遵循這樣的原則「不改寫歷史,如果它是不是真的有必要」,HG故意不讓它特別容易做。重寫歷史記錄以重新排序涉及分支的任意變更集是相當大的手術。使用MQ實際上使得這個過程更容易出錯。 –
相關問題
- 1. 將分支合併到主幹。更改分支的主幹
- 2. 水銀和分支
- 3. 水銀:如何與兩個「主分支」
- 4. 水銀(Hg)和二進制文件
- 5. 水銀(HG)用的UnicodeDecodeError
- 6. 水銀HG更新退出,狀態255
- 7. 水銀克隆失敗:找不到\ .hg
- 8. 水銀分支 - 書籤分支之間的共享變化
- 9. 水銀推關閉分支
- 10. 用水銀SCM分支
- 11. 試圖合併從分支到主密枝早在水銀
- 12. 水銀:
- 13. 把變更到一個新的分支水銀
- 14. 能水銀汞柱出入記錄僅限於分支機構
- 15. 水銀線性歷史記錄使用hg rebase與未改變的變化
- 16. 用水銀
- 17. 將hg分支轉換爲git分支?
- 18. 如何水銀
- 19. 供應商分支,水銀風格?
- 20. 處理修補程序分支水銀
- 21. 水銀分支模型任務功能
- 22. SVN - 合併分支到主幹,覆蓋一些主幹更改/新功能
- 23. 如何合併在水銀
- 24. 水銀合併創造了subrepos
- 25. 在主幹目錄名稱更改後,SVN從主幹分支合併到分支
- 26. 如何顯示在水銀
- 27. SVN從主幹合併到分支
- 28. Subversion - 將分支合併到主幹
- 29. SVN合併主幹到分支
- 30. 將SVN主幹拉到git分支
將合併分支到主幹是一個可接受的解決方案? –
@Matt - 是的,我認爲會的。我只是這樣做了,但是當我必須手動合併我的配置文件時,我會付錢。 – Marcin