-
-
Notifications
You must be signed in to change notification settings - Fork 47
Git Flow
George Asfour edited this page Jun 23, 2025
·
2 revisions
This document explains the branching strategy and workflow used in the Stoplight project.
main
- Contains the latest stable release code
- All releases are tagged in this branch using semantic versioning (e.g.,
v1.2.3) -
The HEAD of
mainshould always be tagged - every commit represents a release - This branch should always be in a deployable state
- Direct commits to
mainare not allowed - only merges from release branches
develop
- Integration branch for ongoing development
- Contains the latest development changes that will be included in the next release
- Feature branches are merged into
develop - Serves as the base for creating new release branches
Release Branches: release/*
- Created from
developwhen preparing a new release - Naming convention:
release/v1.2.3(include the version number) - Used for final testing, bug fixes, and release preparation
- Once ready, merged into both
mainanddevelop - Deleted after the release is complete
- Create a feature branch from
develop - Work on your feature
- Open a pull request to merge back into
develop
- Create a release branch from
develop:git checkout -b release/v1.2.3 develop - Perform final testing and bug fixes on the release branch
- Update version numbers and changelog if needed
- When ready to release:
- Merge the release branch into
main - Switch to
mainbranch and executerake releasewhich:- Tags the hotfix release (e.g.,
v1.2.4) - Publishes the ruby gem
- Pushes tags to the repository
- Tags the hotfix release (e.g.,
- Merge the release branch back into
develop(to include any release fixes) - Merge conflicts could happen at this stage - resolve them locally and push
develop. - Delete the release branch
- Merge the release branch into
When critical bugs are found in the latest release that need immediate fixes:
- Create a hotfix branch from
main:git checkout -b hotfix/v1.2.4 main - Make the necessary fixes on the hotfix branch
- Test the hotfix thoroughly
- When ready to release:
- Merge the hotfix branch into
main - Switch to
mainbranch and executerake releasewhich:- Tags the hotfix release (e.g.,
v1.2.4) - Publishes the ruby gem
- Pushes tags to the repository
- Tags the hotfix release (e.g.,
- Merge the hotfix branch back into
developto ensure the fix is included in future releases - Merge conflicts could happen at this stage - resolve them locally and push
develop. - Delete the hotfix branch
- Merge the hotfix branch into
Important: Always tag hotfixes to maintain the rule that main HEAD is always tagged.
- Keep the
mainbranch stable at all times -
The HEAD of
mainmust always be tagged - every last commit inmainrepresents a release - All development work happens in feature branches.
- Use descriptive commit messages
- Ensure CI passes before merging
- Delete feature and release branches after they're merged to keep the repository clean