57

While using Gitflow, what is the reason for separating branch naming to feature vs bugfix vs hotfix?

I.e. why not just, for example, instead of:

feature/
bugfix/
hotfix/

Just do:

change/

What does separating by feature/bugfix/hotfix buy?

JasonMArcher
  • 12,386
  • 20
  • 54
  • 51
Pavel Chernikov
  • 1,889
  • 1
  • 15
  • 33

1 Answers1

67

Great questions and the answer really depends on how you sort your git. The branching model and gitflow in general is trying to give us some order in the chaos that commits are just after a couple of days.

The image below shows you what they though makes most sense.

(As far as I know it all came from this blog post by Vincent Driessen)

Separating your hotfixes which merge directly into master and your bugfixes which merge into dev makes it easier to go with your product cycle.

The idea is you build your app, create features, make a release candidate (beta test) and then release your app. Hotfixs can be necessary at any time after this. No point in going back all the way to the feature branch and issuing a bug fix there as the feature may already been developed further.

Does that make sense?

enter image description here

Dominik
  • 4,529
  • 6
  • 34
  • 48
  • 8
    I thought hotfixes are bug fixes. Is there a difference? – Danger14 Jul 03 '15 at 04:53
  • 21
    Well yes. A hotfix is a bugfix under pressure :) when you have to fix something for a release that is already out. You don't go back into your feature branch or submodule and fix it there as this module may already have been developed further for the next release. Think windows XP. Full of hotfixes :) – Dominik Jul 05 '15 at 23:44
  • 7
    in git-flow 'hotfix' differs from 'feature' in how they are based and where they are merged to when finished (as shown in the model in this answer). 'hotfix' is based on master and is merged into both master and develop when finished. 'feature' is based on develop and is merged into develop when finished. 'bugfix' is not well documented, but I belive it is only semantically different from 'feature'. – Superole Aug 29 '17 at 12:37
  • 6
    bugfix is a git-flow-avh extension which embodies the functionality of working on the green release line in the above diagram. bugfix branches off the release branch and merges to both the release and development branches on finish. – Alwyn Schoeman Feb 27 '19 at 17:34