Search code examples
gitgit-workflow

Is there a git workflow to describe this scenario?


Currently working from two branches : develop

Feature branches are created from develop and when the changes is complete the feature branch is then merged back to develop.

Currently, we are working on a significant update named u1 that will not be complete for 3 months. In the meantime, we will need to provide other functionality and hotfixes to the current release that is unrelated to u1.

To accomplish this change, I suggest the following :

Create a new branch from develop that will include only the features for u1. All u1 related features will be added to the u1 branch. Continue to create hotfixes etc, feature branches from develop and merge the hotfixes to develop. At some point when u1 is feature complete merge the u1 branch to develop (which contains the hotfixes previously described). Is there a name for this git strategy, are there alternative ways of managing this git workflow ?


Solution

  • A general practice that I have encountered consists of the following rules:

    • there is a master branch, which is equivalent to the code in production
    • there is a develop branch, which is used to stage and test feature branches
    • a feature branch is created from master
    • when a feature branch is ready for testing, merge it to develop
    • if the feature branch's test was unsuccessful, then return to it
    • if the feature branch's test was successful, then before you deploy, merge it to master
    • just before deployment, you do a smoke test on master, that is, you test everything that realistically could go wrong as well as features of critical importance
    • if the smoke test failed, determine what causes the problem and clean master and merge only the features that did not cause trouble
    • if the smoke test succeeded, deploy
    • hotfix branches are branched out from master and merged into master once they are completed
    • if there is an epic feature branch, like the one that you have described, then organize it into divisible sub-tasks
    • each subtask is a task branch branched out from the epic feature branch
    • once a subtask is completed, merge it into your epic feature branch
    • smoke test the epic feature branch before you merge it into develop and then smoke test develop
    • never merge develop into master, since develop may contain untested features
    • whenever a deploy occurred, merge master into develop as well as your epic feature branches