Entry Migration

In Branches, the merge operation is performed on content types and not on the entries within the content types. With the Entry Migration utility, created as part of the Entry Migration flow, you can now merge the entries along with the content types.

This step-by-step guide lets you use the Entry Migration utility to perform the merge operation on entries.

  • The generated entry migration scripts can handle only simple scenarios. For complicated entry migration scenarios, you can customize the migration scripts.
  • The entry migration scripts are available in the merge_scripts folder.
  • If you want to create a script from scratch, you can use the Migration command.



csdx cm:stacks:migration --multiple --file-path <value> --config compare-branch:<value> --branch <value> --stack-api-key <value>


  • -k, --stack-api-key=stack-api-key: Stack API key.
  • --branch=branch: Base branch.
  • --config=config: Inline configuration, compare-branch:<value>. The key for receiving the compare branch name.
  • --file-path=filepath: Path where the entry migration files are stored.
  • --multiple: Migrate multiple content files in a single instance. You must mention the folder path where your migration script files are stored.


csdx cm:stacks:migration --multiple --file-path ./merge_scripts/merge_scripts_bf7xxx-xxx-xxx-xxx-xxx_xxx044 --config compare-branch:develop --branch main --stack-api-key bltxxxxxxxxxxxe

Steps for execution

After performing the merge operation, the merge command generates the merge scripts, and you will get the following message in your terminal:


Follow the steps below to run the migration command:

Note: For Windows OS, please run the following commands first:
npm link lodash
npm link marked
npm link @contentstack/cli-utilities

  1. Copy the entry migration command from the message displayed in your terminal.
    csdx cm:stacks:migration --multiple --file-path <value> --config compare-branch:<value> --branch <value> --stack-api-key <value>
  2. Run the command in your terminal.

This runs the merge scripts, which will be used to merge the entries.

Note: You can find the error logs in the generated file path under logs -> entry-migration.log. For example: ./merge_scripts/merge_scripts_bf7xxx-xxx-xxx-xxx-xxx_xxx044/logs/entry-migration.log

You can also customize the generated merge script to suit your requirements.

For example, if you want to publish the entries using the merge scripts, you can add the publish entry task as follows:

const publishEntriesTask = contentTypeUID => {
  return {
    title: `Publish entries for Content type '${contentTypeUID}'`,
    successMessage: `Entries published successfully for '${contentTypeUID}'`,
    failedMessage: `Failed to publish entries for '${contentTypeUID}'`,
    task: async params => {
      try {
       // Add your custom logic here
      } catch (error) {
Was this article helpful?