Install git flow using the following command.
brew install git-flowsudo apt-get install git-flowIn order to use git flow in your repository, you must first initialize it. This is required for every development environment.
git flow initSet the following during initialization:
Branch name for production releases:
> staging
Branch name for "next release" development:
> dev
Feature branches? [feature/]
> n/a (default)
Release branches? [release/]
> n/a (default)
Hotfix branches? [hotfix/]
> n/a (default)
Support branches [support/]
> n/a (default)
Version tag prefix []
> n/a (default)- Start a feature branch.
git flow feature start feature-name- Develop, commit, push, and create a PR.
[!NOTE] You may also use
git flow feature publish feature-branchto push the local feature branch to the remote repository.
- Once the PR is reviewed and approved, merge to
dev.
[!WARNING] Running
git flow feature finish feature-branchwill merge the feature branch without creating a pull request, so avoid using it.
- Ensure that the local branches are updated.
git pull --all- Start a release branch.
git flow release start release-version-
Make final changes, such as updating versions, and commit.
-
Finish the release
git flow release finish release-version- Back-merge to
dev
git checkout dev
git merge staging- Push updates to remote
git push origin staging dev --tags- On GitHub, create a release from the created tag.
- Select the created tag, then generate the release notes.
- Check "Set as a pre-release".
- Publish release.
- Approve workflow run.
- Verify deployment on staging.
- Merge staging into main.
git checkout main
git pull # Ensure that main is up-to-date
git merge --ff-only staging # Include tag set in staging release
git push origin main --tags- On GitHub, update the release to a full release (uncheck "Set as a pre-release").
- Approve workflow run.
- Verify deployment on production.