How to merge content from one environment to other?

My space has 3 environment - master, develop & qa. I have created a content (ie- an email template) in develop environment. Now i want to add this content to qa environment. As like git, can i merge develop to qa? Or copy the newly created content (on develop) to qa environment?

1 Like

I’m also looking for the best way to do this. Ideally we only have one space with environments, when content is ready on the QA environment, we want to deploy this to the contentful production environment as well.

I’ve read on the import/export tool, but this talks about the entire space. Do we need to use different spaces? Or can we just use environments, how do we migrate content!?

Anyone ?

Has anyone solved this? I can’t find out how to do it.

Hi, using the CLI import/export is the right way. The tool allows to filter entries by type or choose to export only certain set of data:

In the original request the command to export would be something like:
contentful space export --space-id <space-id> --environment-id develop --query-entries 'content_type=xxxx'
If the two environments have the same Content-Type you could use also --content-only

The import would then look like:
contentful space import --space-id <space-id> --environment-id qa --content-file <file>

2 Likes

This worked perfectly, thank you Alma! :rocket:

Doesn’t --query-entries accept id of an entry so I can export only the specific content I want? Right now using your example if I have many content of the same content_type they all get exported. Also is there a flag to skip exporting assets?

Hi @saeid.mohadjer

Here some examples on how to use query-entries:

For not downloading assets, I believe you should use the flag --download-assets false:
https://www.contentful.com/developers/docs/tutorials/cli/import-and-export/

Are we able to automate these cli actions in github actions?

3 Likes