Onshape 提供將文件版本或工作區 (合併的來源) 中的變更與目前使用中文件工作區 (合併的目標) 合併的機制。
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
當您將所選的來源 (工作區或版本) 與目前使用中的目標 (工作區) 合併時,您可以 (1) 使用來源來取代目標中的所有變更,(2) 將來自來源的所有變更合併到目標中,或是 (3) 保留所有來自目標的變更。此外,您可以使用這 3 個相同的策略來指定要如何合併工作區中的各別獨立分頁。
您無法選擇分頁中個別的變更。必須保留、合併或取代來自每個分頁的所有變更。
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
![Video example icon](Resources/Images/icons/help-video@2x.png)
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
「合併」指令會將來自文件版本或工作區的變更 (稱為來源) 合併至您目前使用文件的工作區 (稱為目標)。
按一下「版本與歷程」圖示來開啟飛出視窗。系統會以深藍色強調顯示目前使用中的工作區 (此處標示為 Main 的目標)。在來源上按右鍵 (此處的 B1),然後選取 [合併至目前的工作區]。
合併的對話方塊開啟,顯示從來源和目標分支分叉之後的變更。選擇「整體合併策略」:「保留目標 (Main)」表示要保留目標中的變更,「合併變更」(預設) 代表要合併在來源與目標中的變更,「以來源 (B1) 來取代」表示要用來源中的變更取代目標中的變更。
選擇性地為每個分頁選取合併策略來取代「整體合併策略」。按一下 [合併] 來完成變更。如果在合併之後覺得不對,可開啟「版本與歷程」飛出視窗,然後按一下目前工作區之下的「顯示變更」連結,接著在合併之前的變更上按右鍵,然後在環境選單中點按 [還原至 [目標] (Main)]。
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
-
開啟「版本與歷程」面板。
-
系統會以深藍色強調顯示目前使用中的工作區 (也就是目標;下方圖片中的 Main)。若要將另一個工作區或版本 (也就是來源;下方圖片中的 B1) 合併到目標中,請在來源上按右鍵,然後選取 [合併至目前的工作區]:
-
合併的對話方塊開啟,顯示從來源和目標分支分叉之後的變更:
-
選擇性地選取「整體合併策略」:
-
保留 [目標] - 保留目標中的變更。
-
合併變更 - 這是預設。系統會將來源與目標中的變更合併。
在合併變更時,合併的基準會是分支分叉處的變更 (例如,建立分支處的版本 ),或如果有的話,會是相同來源分支先前合併至這個目標的最後一個點 (假定並未還原合併的情況下)。
-
以 [來源] 來取代 - 來源中的變更會取代目標中的變更。
-
-
選擇性地為每個分頁選取合併策略來取代「整體合併策略」。合併策略的選項與「整體合併策略」相同,除了在分頁建立或刪除處,或是對不支援「合併來自雙方的變更」選項的分頁類型 (請參閱下方的第一個提示)。在這些實例中您僅能選擇 (1) 保持 [目標] 或 (2) 以 [來源] 來取代:
-
有綠色核取記號圖示
的變更表示在該工作區中對分頁的編輯會在合併之後保留在目標工作區中。
-
有紅色 x 圖示
的變更表示在工作區分頁中遭捨棄的編輯 (例如,已刪除的特徵) 會在合併之後保留在目標工作區中。
-
帶有驚嘆號圖示
的變更表示合併之後分頁不會存在於目標工作區中。
-
資訊圖示
表示對於這個分頁類型,無法合併來自個別分支的變更 (例如,工程圖)。您必須選擇目標 (保留 [目標]) 或來源 (以 [來源] 來取代)。請參考無法合併來自個別分支變更的分頁。
-
-
Click Merge. In the Versions and history graph, the merge lines show that branch B1 has been merged into the Main branch.
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
復原合併的操作:
-
Open the Versions and history panel and make sure merge lines are shown.
-
Right-click the last change on the Target branch before the merge, and click Restore to [Target]. In the example below, we right-click V1, and then click Restore to Main:
-
After this restore, all tabs in the Target workspace are reset exactly as they were before the merge. Future merges view changes as if the merge did not occur. To see the restore point in the Versions and history graph, click the Show changes link under the Target branch.
詳細資訊請參考文件管理。
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
All merges are displayed explicitly in the Versions and history graph, which updates automatically as changes are made to the document.
Showing and hiding merge linesTo make the Versions and history graph easier to visualize, toggle the Show/Hide merges and Show/Hide automatic versions buttons as needed:
A Versions and history graph with merge lines and automatic versions shown (above).
A Versions and history graph with merges hidden (above).
A Versions and history graph with automatic versions hidden (above).
Merge lines exampleThe example below shows a complex Versions and history graph with several branches. Each branch was created from the Main workspace, and then individual work was done on each branch. As work on each branch was completed, the branches were merged back into Main. The flow of lines to and from the Main branch shows the merging workflow, making it easy to see which changes were merged when.
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
在要合併分頁時,僅為 Part Studio、組合件與 Feature Studio 分頁類型提供「合併來自雙方的變更」選項。其他所有的分頁類型 (例如,工程圖、Render Studio 等等) 僅允許您選擇目標 (保留 [目標]) 或來源 (以 [來源] 來取代) 分頁。選擇一個選項會覆寫另一個選項中的變更。
基於這個理由,當在不是 Part Studio、組合件或 Feature Studio 中的分頁操作時,建議您在一個工作區 (分支) 中操作,然後將該分支與其他分支合併。在其他分頁類型的兩或多個分支上同時操作時,合併分支可能會導致變更的遺失。
例如:
-
在 Main (目標) 中建立一個工程圖 (Drawing 1),然後插入一個零件。
-
建立一個版本 (V1),然後從這個版本產生一個分支 (來源 B1)。
-
在 B1 工作區中,於 Drawing 1 分頁內將尺寸加入到零件的一個邊上。
-
在 Main 工作區中,將尺寸加入到同一 Drawing 1 分頁內相同零件的不同邊上。
-
將 B1 (來源) 工作區的變更合併到 Main (目標) 工作區中。
-
在合併對話方塊中為 Drawing 1 分頁選擇「分頁合併策略」,系統會提示您選擇下列之一:
-
保留 Main - 這會保留來自 Main 工作區的 Drawing 1 分頁。系統會保留加入到 Main 工作區的尺寸,覆寫掉加入至 B1 的尺寸。
-
以 B1 來取代 - 這樣會以 B1 工作區的 Drawing 1 分頁來取代 Main 工作區的 Drawing 1 分頁。系統會以加入至 B1 的尺寸覆寫加入到 Main 工作區的尺寸。
在上方的兩個案例中,系統會保留一個尺寸並覆寫另一個尺寸。若要避免此種情況,請僅在一個工作區 (例如 Main) 中對 Drawing 1 分頁進行所有操作,然後在將 B1 合併到 Main 時,選擇「保留 Main」,這樣就可以保留所有在 Drawing 1 分頁中的變更。
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
If the target and source branches are the same, and all tabs use a Keep merge strategy, no updates are needed. The Merge button will be unavailable.
- To replace the target branch with the source branch, change the Tab merge strategy to Replace.
-
Click Merge.
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
When working with protected branches, the working branch must be kept up-to-date with the protected branch before a merge can occur. If the Merge button in the Merge dialog is disabled and you see the Workspace protections are enabled warning:
- Close the Merge dialog to return to the document.
- Select the working branch in the Versions and history graph.
- With the working branch selected, right-click the protected branch and select Merge into current workspace from the context menu.
- In the Merge dialog, confirm that you are merging the protected branch into the working branch, then click Merge. The working branch is updated with the changes from the protected branch.
- In the Versions and history graph, select the protected branch.
- With the protected branch selected, right-click the working branch and select Merge into current workspace.
- You should now be able to merge your changes into the protected branch.
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
Branches with outdated versions of FeatureScript cannot be merged. If one or more branches uses an old version of FeatureScript, you will see a warning message about this version mismatch in the Merge dialog.
-
Click the Update FeatureScript icon
to update the FeatureScript versions in both the target and source branches to the latest.
- Click Update now in the window that opens to complete the update.
- Click Merge.
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
Branches cannot be merged if the document is in use. If another user has the document open, or if you have the document open in multiple browser windows or tabs, you will see an error that lists the users and number of open instances.
- Ensure that you and other users have closed out of the document.
- The dialog will automatically refresh, and you can click Update now.
- If Onshape is unable to verify that the document is not in use (i.e., due to network connectivity issues) you will see the warning below:
- Click the Retry icon
in the dialog to attempt verification again.
- If Onshape is unable to verify that the document is not in use (i.e., due to network connectivity issues) you will see the warning below:
- Click Merge.
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
Merges cannot be completed while updates are still in progress. Try again later after the current update is complete.
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
-
由於無法使用
「復原」圖示來還原一個合併,因此在執行合併之後,會開啟一個訊息,其中有您可以點按以還原合併的一個連結。當轉換分頁、工作區與比較不同工作區時這個訊息會持續出現,讓您可以檢查合併的結果。按下
「關閉」圖示來接受合併並結束訊息:
如果在合併文件之後,您或其他使用者變更了文件,然後您又還原了合併,則變更會遺失。
-
如果沒有任何變更存在會需要合併來源與目標,在合併對話方塊中的選項會僅是 (1) 保留 [目標] 或 (2) 以 [來源] 來取代。預設的選項是以 [來源] 來取代:
-
按一下合併對話方塊中的「與基準比較」連結,系統會開啟一個新的瀏覽器分頁,其中比較來源與目標。詳細資訊請參考比較。
-
若要合併一或多個分頁的變更而不改變目前工作區中的任何其他項目,請為「整體合併策略」 選擇「保留 [目標]」,然後根據您的需求為每個分頁選擇「以 [來源] 來取代」或「合併來自雙方的變更」。
-
在合併對話方塊中對分頁的排序是將有變更的分頁排在上方,沒有變更的分頁則在下方。接著每個部分會根據分頁在分頁列中由左到右的位置從上到下排列,會先顯示目標分支,然後再顯示來源分支,不會顯示資料夾。
![封閉](../Skins/Default/Stylesheets/Images/transparent.gif)
當您將所選的來源 (工作區或版本) 與目前使用中的目標 (工作區) 合併時,在來源中所做的全部變更將會合併至目標中,包括所有其他的特徵、分頁等等。
步驟
-
輕觸「版本與歷程」圖示
來開啟面板:
-
Select the target branch (the branch to merge into) in the Versions and history panel.
- With the target branch still selected, tap the three-dot menu to the right the source branch (the branch to merge), then tap Merge into current workspace.
在來源中所做的變更會全部合併至目前啟用的工作區中 (目標)。會將這個動作記錄在版本與歷程飛出視窗內的項目中,如果需要,您可以還原為之前的記錄來還原合併的動作。關於還原版本的詳細資訊,請參考文件管理。
當合併包含工程圖、圖片、PDF 或其他不是 Part Studio 或 Assembly 分頁的工作區時,如果同時在來源與目標的分頁中做出變更,則在來源分支中的變更會覆寫在目標分支中的變更。例如,如果您同時更新兩個分支 (來源與目標) 中的 PDF 分頁,然後合併分支,則合併之後,來源分支中的 PDF 會出現在目標分支中。
提示
當合併包含工程圖 (在工程圖分頁中) 的工作區時,合併過程中會以有變更的工程圖為優先。明確地說,當來源與目標分支中的工程圖同時有變更時,會以來源工程圖為優先:
- 如果在來源中的工程圖變更而目標中的工程圖並未變更,則會將來源中的工程圖複製到目標中,取代目標中的工程圖。任何並出現在來源中的目標工程圖內的變更則會被覆寫。
- 如果來源工作區的工程圖沒有變更 (相較於目標中的工程圖),則在目標中的工程圖會保持不變。
建議您在一個工作區的一個工程圖 (分支) 上進行操作,然後將該分支合併至另一個分支中。同時在一或多個分支上操作工程圖可能會導致將工程圖從一個分支合併到另一個分支時,變更的遺失。