main, master, whichever chosen during project creation) always represents the production environment.
Other branches are for developing new features, fixing bugs, or updating the infrastructure.
To make changes to your project, follow these steps:
1. Create a new environment
Create a new environment (a Git branch) to make changes without impacting production: Run the following command:Terminal
feat-a Git branch based on the main Git branch
and activates a related environment on Upsun.
The new environment inherits the data (service data and assets) of its parent environment (the production environment here).
2. Make changes to your project
Depending on the stack you’re using, change something within your source code.3. Commit your changes
Terminal
4. Deploy your changes
Deploy your changes to thefeat-a environment:
Terminal
Terminal
5. Iterate
Iterate by changing the code, committing, and deploying. When satisfied with your changes, merge them to the main branch, and remove the feature branch:Terminal
Deploying after a merge is fast because the image built for the feature environment is reused for the targeted environment.
6. Keep your branch up to date
For a long running development branch, to keep the code up-to-date with themain branch, use git merge main or git rebase main.
You can also keep the data in sync with the parent environment by using upsun env:sync data.