Branching Strategy
Chronos internal projects will follow the Gitflow pattern for branching. Gitflow is the standard for all new projects.
Branching Models
Gitflow
Gitflow is a branching model that organizes a repository into distinct branches, each with a unique purpose. It facilitates the ability to generate quality software via a stable release and development process.
Diagram created by Vincent Driessen
Branches
master
- Each commit in
mastershould reflect a stable release and be tagged with that release's version number. - The latest commit in
masterreflects the build currently available in the App Store. - Until the first version of the app is released,
masterwill usually reflect the initial state of the repository.
develop
- The main development branch, which reflects the most current non-shipped version of the app.
- Serves as the main integration point for new features/fixes as they are developed.
- The CI system points to
developby default.
feature/*
- Represents a feature actively in development (e.g.
feature/login_screen). - Initially branched from
developto start feature work. - As the feature is developed,
developshould be merged intofeature/*periodically to keep the feature branch up-to-date with the latest changes. - Once the feature is complete, the
feature/*branch is merged intodevelop(via pull request) and then removed.
release/*
- Represents a release candidate (e.g.
release/2.1.0). - Initially branched from
developto start a code freeze process.- Only bugfixes should be merged into the
release/branch (i.e. no merging fromfeature/branches).
- Only bugfixes should be merged into the
- Merged into
developperiodically so that fixes get incorporated into new feature development. - Merged into
masterand tagged using semantic versioning once a release is complete (i.e. the app/update is live). - Merged into
developone last time before being removed. - QA will perform the bulk of their testing on builds created from this branch.
hotfix/*
- Represents a "hotfix" update used to quickly address issues with the live app.
- Initially created from the corresponding version number tag on the
masterbranch (e.g.2.1.0-->hotfix/2.1.1). - Allows for production issues to be resolved quickly without interrupting active feature development or having to manually cherry-pick or re-apply fixes from
develop. - Follows the same process as a
release/*branch to keepdevelopup-to-date with any fixes and finalize the hotfix release.
bugfix/*
- Represents a bugfix actively in development (e.g.
bugfix/login_screen). - Initially branched from
developto start the bugfix work. - As the bugfix is developed,
developshould be merged intobugfix/*periodically to keep the bugfix branch up-to-date with the latest changes. - Once the bugfix is complete, the
bugfix/*branch is merged intodevelop(via pull request) and then removed.
Key Stages
- The repo is created with only a
masterbranch, by default. - A
developbranch is created frommaster. -
feature/*branches are created fromdevelop. - When a feature is complete, it's merged into
develop(via PR) and then removed. - To initiate a release, a
release/*branch is created fromdevelop. - When a release is complete,
release/*is merged intodevelopandmaster, tagged, and then removed. - If an issue in
masterneeds to be resolved, ahotfix/*branch is created frommaster. - When the hotfix release is complete,
hotfix/*is merged intodevelopandmaster, tagged, and then removed.
Commits
Commit early, commit often! Try to remember to push any pending commits to the remote repo at the end of every day so that all in-progress work is backed up.
Commit messages should be detailed and helpful - avoid anything that's not a complete sentence.. A good rule of thumb to follow is to begin commit messages with a verb so that the message completes the phrase "This commit...".
Merging
All merges into develop, release/, hotfix/, bugfix/* should happen via pull requests. This ensures that all code gets reviewed at some point before it's shipped.
Deleting Branches
Branches should be deleted after they've been merged into develop or master. This keeps the repository clean and makes it clear where active development is occurring.