Merging guide

From Crusader Kings II Wiki
Jump to: navigation, search

This guide describes the steps to retrofit the changes from a vanilla patch, for a mod that modifies some vanilla files.

It is best to avoid copying and modifying vanilla files inside a mod (by loading from folders), but sometimes this is unavoidable.

If you do, there is some extra work needed for every vanilla patch, to merge changes with your own, and make the mod compatible with the new patch:

'Base' file (vanilla version N) ----------------> 'Destination' file (vanilla version N+1)
  |                                New patch             |
  | Copied and modified                                  | Propagating vanilla changes
  |                                                      |
  v                                                      v
'Source' file (mod version N)   ----------------> 'Result' file (mod version N+1)
                             Keeping mod changes

Merge tool[edit]

Ideally you should use a 3-way merge tool, with 3-way folder merging capability:

  • 3-way text merging will resolve most conflicts automatically, allowing to complete much faster and with less risks of mistakes.
  • 3-way folder merging allows to trigger the 3-way text merge of files that need merging more conveniently.

Some 3-way merge tools:

Note that WinMerge doesn't support 3-way merge, only 2-way diff.

Launching the merge[edit]

3-way merge is composed of 4 windows:

  • Source: The mod
  • Base: The last vanilla version for which the mod was updated for
  • Destination: The vanilla version to updated to
  • Result: The mod

For simplicity, it's common to have source and result work on same files, but make sure the old version of the mod is backed-up in case you need to re-start the merge for any reason.