Provide visual explanation of what happens for each Sitecore package install options and be a good reference for Sitecore devs.
Basic understanding of Sitecore package installation. If you are not familiar with package installation, please refer to Creating A Package In Sitecore by Ashwinder Manhas.
A single Sitecore item with versions will be considered. Behaviours of its children will not be visualized in this blog.
Let's look at all the installation options, ordered by the most vague description, to least vague.
Overwrite and skip are really straight forward, but the description provided for merge is really cryptic. One major source of confusion is: "What exactly is being merged?" What Sitecore really means, is it's trying to merge the VERSIONS of the item. So, we should be looking at how the versions of an item behave when installing packages.
For the purpose of illustration, I prepared a test item with 3 versions. The red text on the right represents an arbitrary text field that will be used to track which version remains after package install.
A slightly modified version of the original item has also been prepared, which will be installed. Note that version 1 has been removed and 4 has been added. Here the single quote is added to create distinction between original and modified.
I now present the results of installing the modified item in 2.2 to the item in 2.1. Only the results of merge are shown. (Overwrite and skip are a bit trivial to show).
Perhaps the clearest (also the deadliest to original item's versions) of all merge options. All versions from the original item are gone and are replaced by the new item's versions. Note that the version numbers on the left are not preserved, but are mapped like so: (4, 3, 2) -> (3, 2, 1). It's not hard to see that new version numbers start from 1.
As the name suggests, it simply stacks new item's versions on top of old item's versions. ALL versions survive the install. This is definitely the option to use if you do not want any loss of data.
Wherever there was overlap (version 2 and 3), it has been replaced by the new item's versions. If no overlap (version 1 and 4'), they were simply carried over. This is perhaps the most versatile of all the merge options, but can lose vital data if used improperly.
Hopefully this blog removes some of the ambiguities around Sitecore package installs. This simple test case by no means is a representative of all installation scenarios and edge cases. I intend to cover more depths and cases in future blogs.
Sign up to our bi-weekly newsletter for a bite-sized curation of valuable insight from the Sitecore community.