gitgit-flow

Addressing the hotfix, bugfix, and versioning aspects for GitFlow?


I'm using GitFlow to manage an application that includes 3 features and 2 releases. Release 1.0.0 will include Feature 1, while Release 2.0.0 will include Feature 2 and Feature 3.

so here are the GitFlow steps for the release 1.0.0

  1. Create the Feature 1 branch from develop.
  2. Finish Feature 1 and merge it back into develop.
  3. Ensure that develop is stable and ready for release.
  4. Create a release branch (e.g., release/1.0.0) from develop.
  5. Test on the release branch and fix any bugs.
  6. Create a release tag (e.g., v1.0.0) on the release branch.
  7. Publish the application to the App Store with version 1.0.0.
  8. Merge the release branch into both main and develop.

As the application 1.0.0 is released in the appstore and people are using it,

here is the plan for the second release 2.0.0:

  1. Features 2 and Features 3 are finished.
  2. Merge into the develop branch.
  3. Created a release branch (e.g., release/2.0.0) from develop.
  4. testing is ongoing on release/2.0.0

Releasing 1.0.0 using GitFlow looks good to me but I'm looking to address hotfixes, bugfixes, and versioning using GitFlow for the following use cases:

  1. If people report a critical bug in 1.0.0 that requires the immediate release of a new application?
  2. If people report a bug, I want to fix it and include that bug fix in the next release, 2.0.0 ?
  3. QA reports a bugs in release/2.0.0 ?

Solution

  • See Atlassian's Gitflow workflow tutorial for reference, and for how to do this easily with the gitflow tool. For versioning, see Semantic Versioning.

    Bugs can be fixed in a feature branch, or a hotfix branch, or a release branch. Which you use depends on the urgency of the fix.

    If people report a critical bug in 1.0.0 that requires the immediate release of a new application?

    Make a hotfix branch off main. Fix the bug. Merge it into both main and develop. Since it's a bugfix, increment the 3rd number; release 1.0.1.

    If people report a bug, I want to fix it and include that bug fix in the next release, 2.0.0 ?

    Since you're in the middle of releasing 2.0.0 and want it in 2.0.0, fix it in the 2.0.0 release branch.

    Once 2.0.0 is released the release branch will be merged back into develop bringing the bugfix with it.

    QA reports a bugs in release/2.0.0 ?

    If you want it fixed in 2.0.0, fix it in the 2.0.0 release branch. Same as above.

    If it can wait until the next release, fix it in a feature branch.