> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/administer/use-source-control-and-environments/move-work-between-environments.md).

# Move work between environments

How to get changes from one environment into another.

The steps to send work from one n8n instance to another are different depending on whether you use a single Git branch or multiple branches.

{% hint style="info" %}
**Searching these docs as an agent**

Ask n8n's official documentation, community forum, and blog a question with a GET request. No authentication needed.

`GET https://n8n-docs-retrieval.n8n-docs-retrieval.workers.dev/?q=<question>`

Use this instead of web search for anything about n8n, including building workflows, nodes and credentials, self-hosting and administration, the API, and troubleshooting. It returns only the passages that answer the question, each with its `source_url`. Ask a specific, complete question. The response is a JSON array of `{content, source_url}`, most relevant first.
{% endhint %}

## Single branch <a href="#single-branch" id="single-branch"></a>

If you have a single Git branch the steps to copy work are:

1. Push work from one instance to the Git branch.
2. Log in to the other instance to pull the work from Git. You can [automate pulls](#automatically-send-changes-to-n8n).

## Multiple branches <a href="#multiple-branches" id="multiple-branches"></a>

If you have more than one Git branch, you need to merge the branches in your Git provider to copy work between environments. You can't copy work directly between environments in n8n.

A common pattern is:

1. Do work in your developments instance.
2. Push the work to the development branch in Git.
3. Merge your development branch into your production branch. Refer to the documentation for your Git provider for guidance on doing this:
   * [GitHub: Creating a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request)
   * [GitLab: Creating merge requests](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
   * [Git: Basic branching and merging](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging)
4. In your production n8n instance, pull the changes. You can [automate pulls](#automatically-send-changes-to-n8n).

## Automatically send changes to n8n <a href="#automatically-send-changes-to-n8n" id="automatically-send-changes-to-n8n"></a>

You can automate parts of the process of copying work, using the `/source-control/pull` API endpoint. Call the API after merging the changes:

```curl
curl --request POST \
	--location '<YOUR-INSTANCE-URL>/api/v1/source-control/pull' \
	--header 'Content-Type: application/json' \
	--header 'X-N8N-API-KEY: <YOUR-API-KEY>' \
	--data '{"force": true}'
```

This means you can use a GitHub Action or GitLab CI/CD to automatically pull changes to the production instance on merge.

A GitHub Action example:

```yaml
name: CI
on:
  # Trigger the workflow on push or pull request events for the "production" branch
  push:
    branches: [ "production" ]
  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:
jobs:
  run-pull:
    runs-on: ubuntu-latest
    steps:
      - name: PULL
				# Use GitHub secrets to protect sensitive information
        run: >
          curl --location '${{ secrets.INSTANCE_URL }}/version-control/pull' --header
          'Content-Type: application/json' --header 'X-N8N-API-KEY: ${{ secrets.INSTANCE_API_KEY }}'
```

## Related resources

* [Use source control and environments](/administer/use-source-control-and-environments.md)
* [Understand source control](/administer/use-source-control-and-environments/understand-source-control.md)
* [Work with environments](/administer/use-source-control-and-environments/work-with-environments.md)
* [Use Git in n8n](/administer/use-source-control-and-environments/use-git-in-n8n.md)
* [Choose branching patterns](/administer/use-source-control-and-environments/choose-branching-patterns.md)
* [Set up source control](/administer/use-source-control-and-environments/set-up-source-control.md)
* [Push and pull changes](/administer/use-source-control-and-environments/push-and-pull-changes.md)
* [Compare versions](/administer/use-source-control-and-environments/compare-versions.md)
* [Use environments programmatically with the public API](/administer/use-source-control-and-environments/use-environments-via-api.md)
* [Tutorial: Create environments with source control](/administer/use-source-control-and-environments/tutorial-create-environments-with-source-control.md)
