Project branching allows developers to checkout code from the existing git branch and isolates their work from others. If you are a member of WaveMaker Teams, read further to understand best practices for managing branches in WaveMaker.
In Git flow, the main (or master) branch contains your production-ready code. You can use the main (or master) branch for CI/CD integration. The other branches, feature branches, hotfix branches should contain work on new features and bug fixes and will be merged back into the main (or master) branch when the work is finished and properly reviewed.
Git Flow Considerations
While working with the Git flow branching strategy, there are six principles you should adhere to to ensure you maintain good code.
- Any code in the main(or master) branch should be deployable, production-ready.
- Create new descriptively-named branches off the main branch for new work, such as feature/add-new-payment-types.
- Commit new work to your local branches and regularly push work to the remote.
- To request feedback, help, or when you think your work is ready to merge into the main branch, open a pull request.
- After your work or feature has been reviewed and approved. It can be merged into the main branch.
- Once your work has been merged into the main branch, it should be deployed.
Advantages of Git Flow
- Because of the simplicity of the workflow, this Git branching strategy allows for Continuous Delivery and Continuous Integration.
- This Git branch strategy works great for small teams and web applications.
Implementing in WaveMaker
WaveMaker supports the creation of a project using an existing branch in Git. We can follow the above Git model using the below steps:
- Creating an Application (for example, SampleApp) from WaveMaker will create a repository with the main (or master) branch in Git.
- By Default, all Contributors of this Project will push their changes to main (or master).
- Anything in the main (or master) branch is deployable.
- The above application will always point to the main (or master) branch.
- Use this application to always PULL from main (or master) branch.
- Do not commit to the main ( or master) directly. Do not hotfix into main (or master). Instead, use a feature/hotfix branch.
- To work on something new, go to the Git portal (for example, Github, Gitlab etc) and create a branch from main (or master) in the repository (for example, SampleApp). Give it a descriptive name (for example, feature/new-oauth2-scopes).
- Now again, from WaveMaker, go to option Create Project Branch for the application mentioned above (for example, SampleApp), and create a project branch by selecting the appropriate branch. Following the above example, we’ll select branch
feature/new-oauth2-scopes. This will create a new branch project, pointing to the branch
Developers can start collaborating and working on this project, named
feature/new-oauth2-scopes, and can regularly push their work.
- Developers can review the changes using Preview in WaveMaker.
- Users can also deploy the feature branch to an external testing environment using a branch from Git or exporting a war file from WaveMaker. Refer to the below screenshot to download the war file.
After the required changes are done and tested in the feature branch, you can merge it into the main (or master). Merging the feature branch into the main (or master) branch is done outside of WaveMaker and through Git portals like Github, Gitlab, etc.
- In our example, Merge
feature/new-oauth2-scopesbranch into the main (or master) branch from Git portals like Github, Gitlab, etc.
- In our example, Merge
Once it is merged and pushed to main (or master) branch, you can PULL the latest changes into the main (Master) Project (refer to Steps 1, 2 & 3) and deploy from WaveMaker or use CI/CD to deploy from the main (Master) branch.
- Users can deploy from a master project from WaveMaker for Testing the main (or master) branch.
- User can configure the main (or master) for Continuous Integration and Continuous Deployment in their external deployment pipeline.