Best practices: Version control
This section covers best practices for using the version control feature with one or more teams
Your Main branch is the only branch you can deploy to Live (except for the hotfix branch) and you should keep this in mind as you organize Main's child branches.
What this means is that changes and experimentation should always be completed in full in a child branch and then merged up through the hierarchy until it reaches the Main branch.
At that point it should be safe to delete the child branches and there should be no development work done in the Main branch. This means that the Main branch should always be the "polished" last branch of your app that's ready to be deployed.
Whenever you want to merge changes from a child branch to a parent branch, we recommend that you first merge changes from the parent branch into the child branch. This is because it's lower risk to test that everything works well in the child branch before you then merge the changes up the hierarchy into the parent branch. The same holds true when you are merging a custom branch into the Main branch. Use the Sync with Main shortcut to add all changes from Main into the custom branch first.
In other words:
- 1.First merge the changes from the parent to the child
- 2.Do the necessary testing in the child branch
- 3.Then merge the changes from the child to the parent
Whenever a branch has served its purpose (the development is done and the changes have been merged up the hierarchy) you should delete the branch to keep your branch tree updated. Keeping around unnecessary branches makes the tree disorganized and it's easy to lose sight of why the branch was created in the first place, whether it has been merged upward already and whether it's safe to delete.
You can always create a new branch as needed, so there's no need to keep around the old ones.