Continuous Delivery Git Workflow

Senior disclaimer: the flow below may seem pretty obvious for experienced developers. However, usually it’s hard to explain something without putting it down to any sign form. So, please either skip the following or share the link with your juniors. You’ve been warned.

Couple of general notes:

  • You don’t need the dev branch if you can easily deploy a test instance for any (feature-)branch.

  • You need release branches if you aren’t confident in your monitoring and cannot easily revert a bad prod deploy.

Please, note that the flow of code review (CR) in general is covered elsewhere.

  1. As an author start a feature branch from the current master branch. In our example for a task CV-000 let it be 000-some-feature forked from the master. We can’t start from dev considering it can include some out-of-release scope.

  2. Develop the feature and test it locally.

  3. When creating a merge request (MR) from a feature branch (000-some-feature) to dev:

    1. remove the checkbox “Delete source branch when merge request is accepted.”,

    2. set the milestone.

    3. If you created the MR during development, mark it as draft. Remove the mark at this point of the process.

  4. If there’re any conflicts in the MR to dev:

    1. First, from the feature branch (000-some-feature) create a conflict resolving branch, e.g. 000-dev-conflicts. The name doesn’t really matter, but must contain the task number.

    2. Merge the freshest dev branch (after pull) to the conflict resolving branch (000-dev-conflicts). Resolve conflicts. Push.

    3. Create another MR to dev with the source branch set to the conflict resolving branch (000-dev-conflicts).

    4. Set the checkbox “Delete source branch when merge request is accepted.” for this conflict MR.

  5. After successful CR merge into dev. When pipelines succeeded:

    1. Move the respective task to a QA assignee.

    2. Create another MR from the feature branch (000-some-feature) to the master branch or edit original MR to dev in case of dev conflicts by changing its target branch. In the MR:

      1. set the checkbox “Delete source branch when merge request is accepted.”,

      2. assign to the team lead,

      3. start the name from sprint’s ID and task number, e.g 21.10.a CV-000 …,

      4. set the milestone.

  6. If the task doesn’t pass the QA fix it in the feature branch and create another MR to dev, as usual (see pp.3-4). No action required for the master MR. It’ll be automatically updated since the feature branch is the same.

  7. When the task successfully passes the QA the team lead merges it to the master branch. If the QA process isn’t finished in the current sprint the author changes the milestone and title in the master MR to the next sprint.