Sandbox environments
Now you have two independent environments (main & dev) in the cloud and have corresponding git branches with your amplify backend infrastructure code on Git. Suppose a team member wants to work on the same Amplify project, add some features to it and then push changes to the dev environment to test some changes. They would perform the following steps:
1$ git clone <git-repo>2$ cd <project-dir>3$ git checkout -b mysandbox4$ amplify env add5? Do you want to use an existing environment? No6? Enter a name for the environment mysandbox7// Rest of init steps8// Add/update any backend configurations using amplify add/update <category>9$ amplify push10$ git push -u origin mysandbox
Next, suppose the team-member wants to move these changes to dev and main environments/branches:
1$ git checkout dev2$ amplify env checkout dev3$ git merge mysandbox4$ amplify push5$ git push -u origin dev
After testing that everything works fine in the dev stage, you could now merge dev to the main git branch:
1$ git checkout main2$ amplify env checkout main3$ git merge dev4$ amplify push5$ git push -u origin main
In this approach, you can consider the git branches (dev & main) as the source of truth and all the team members should work off the branches and keep their workspaces in sync.