Search code examples
gitmergeatlassian-sourcetreegit-flowhotfix

Long term support using git-flow to merge a hotfix to develop branched off the support branch


Doing experimental learning of git flow for my new project.. I noticed the following:

The following scenarios:

  1. Normally git-flow workings:

    git flow hotfix start 1.1.2

    Will create a branch based on master and when done merges with master and develop.

  2. Branching based on another branch

    git flow hotfix start 1.1.3 support/1.x

    But then the hotfix created based on support branch will merge back into that support branch and not back into develop nor master but will be tagged when finished.

Problem

If my master branch is currently in v3.2.0 but the hotfix was for an issue in a code section introduced in v1.1 but still relevant and used in the current development branch, how do I go about merging them together?

The reason for this question is that some clients would need long term support of a specific older version even if your newer version is more superior.

Possibly solution but not( using SourceTree)

Atlassian SourceTree always only merge finish hotfix with master and develop but never with the support branch that is needed by clients (tested thrice)


Solution

  • If my master branch is currently in v3.2.0 but the hotfix was for an issue in a code section introduced in v1.1 but still relevant and used in the current development branch, how do I go about merging them together?

    Since you won't merge an hotfix branch (where the issue was solved) into master, you can cherry-pick the relevant commit back to master.

    log view (Cmd-2), just select one or more commit lines (Cmd-click or Shift-click multi-selects), then right-click and select 'Cherry pick'.

    https://answers.atlassian.com/download/attachments/15697265/Capture.PNG?version=1&modificationDate=1431431872796&api=v2