Create a branch for development

After cloning your project and updating the Adobe Commerce administrator account configuration, you can branch for development. As stated earlier, you must create an environment using the magento-cloud environment:branch <branch-name> command or the Cloud Console for the environment to become active.

  • For Starter, consider creating a branch for staging, then create a development branch based on the staging branch.
  • For Pro, create development branches based on the Integration branch.

To create a development branch:

  1. On your local workstation, change to your project directory.

  2. Create an environment based on the branch recommended for your project workflow.

    magento-cloud branch <new-environment-name> integration
    
  3. Update dependencies.

    composer --no-ansi --no-interaction install --no-progress --prefer-dist --optimize-autoloader
    
  4. [optional] Create a backup of the environment.

Merge a branch

After completing development, merge this branch to the parent:

  1. Commit and push code changes:

    git add -A && git commit -m "Add message here"
    
    git push origin <branch-name>
    
  2. Merge with the parent environment:

    magento-cloud environment:merge <environment-ID>
    

Delete an environment

Only delete an environment if you are certain that you no longer need it. You cannot recover an environment after you delete it.

WARNING
You cannot delete the master branch of any project.

You must be a project administrator, environment administrator, or Account Owner to perform this task. See Manage user access to Cloud projects.

When you delete an environment, the environment is set to inactive. The code is still available in the Git branch, but no longer contains the services or the database. To delete the environment completely, you must also delete the corresponding remote Git branch.

To delete an environment:

  1. On your local workstation, change to your project directory.

  2. Fetch updates from the remote server.

    git fetch
    
  3. Delete the environment branch.

    magento-cloud environment:delete <environment-ID>
    

    Optionally, you can delete more than one environment at a time by adding multiple environment IDs to the delete command.

    magento-cloud environment:delete <environment-1-ID> <environment-2-ID>
    
  4. Respond to the prompts to delete the local environment and the corresponding remote environment.

    The environment <environment-ID> is currently active: deleting it will delete all associated data.
    Are you sure you want to delete the environment <environment-ID>? [Y/n]
    

    Deleting the environment places it in an inactive state.

    Delete the remote Git branch too? [Y/n]
    

    Deleting the remote Git branch removes the environment from the project.

  5. Wait for the environment to delete.

    Deleting environment <environment-ID>
    Waiting for the activity...
      Deleting environment <project-id>-<environment-ID>-xxxxxx
    
      [============================]  1 min (complete)
    Activity ID succeeded
    Deleted remote Git branch <environment-ID>
    Run git fetch --prune to remove deleted branches from your local cache.
    
TIP
To activate an inactive environment, use the magento-cloud environment:activate command.

Interact with remote environments

After you set up SSH keys, you can connect from your local workspace to a remote environment and interact with your project services and modify settings.

Previous pageAuthentication keys
Next pageSecure connections

Commerce