gitflow-avh icon indicating copy to clipboard operation
gitflow-avh copied to clipboard

Git flow hotfix doesn't want to start a hotfix off a tag

Open chhh opened this issue 8 years ago • 7 comments

Here's what repo history looks like:

git-flow-hotfix-bug

$ git flow hotfix start v5.2 v5.1
Fatal: Base 'v5.1' needs to be a branch. It does not exist and is required.
$ git --version
git version 2.16.2.windows.1

Update 1: I tried manually installing the latest clone of this repo into msysgit, the result was the same.

Update 2: I've set up a repo for demo purposes which has 2 releases made with git-flow commands:
https://github.com/chhh/git-flow-hotfix-test

Now while on develop try

git flow hotfix start 'v2.1' 'v2.0'

I get:

Fatal: Base 'v2.0' needs to be a branch. It does not exist and is required.

chhh avatar Mar 08 '18 21:03 chhh

@chhh, I had a similar problem (#355) with starting a support branch but I think it may have been caused by the specified base tag's absence in the origin repository. Are you certain that the tag you specified had been pushed to the origin repository beforehand or did it only exist in your clone?

jkankiewicz avatar May 21 '18 17:05 jkankiewicz

@jkankiewicz Here's a repo I've just set up for demo purposes: https://github.com/chhh/git-flow-hotfix-test It has 2 releases made with git-flow commands. All the tags are published. Now while on develop try

git flow hotfix start 'v2.1' 'v2.0'

I get:

Fatal: Base 'v2.0' needs to be a branch. It does not exist and is required.

chhh avatar May 21 '18 19:05 chhh

@chhh, After further consideration, I think that the optional <base> argument is only supposed to be a branch's name and never a tag because a hotfix branch is either supposed to be merged directly into the master branch or a support branch (which is essentially an alternate master branch because one is always based upon a past version of master). In other words, you skipped the step of creating a support/v2.x branch (which can be based on the v2.0 tag) upon which you could then base the hotfix/v2.1 branch. Even if v2.0 is the latest release then you still don't need to specify a tag when starting a hotfix branch because the master branch would be synonymous with the v2.0 tag.

jkankiewicz avatar May 23 '18 02:05 jkankiewicz

@jkankiewicz that makes some sense. I still think, that a hotfix/v2.x could just be created automatically and just kept there without being deleted - it would serve the role of support/v2.x branch itself. Can still be merged into master.

chhh avatar May 23 '18 19:05 chhh

I still think, that a hotfix/v2.x could just be created automatically and just kept there without being deleted - it would serve the role of support/v2.x branch itself.

@chhh, Only the master, develop and support branches are supposed to persist; bugfix, feature and hotfix branches are supposed to be ephemeral. You could make your hotfix branches serve double-duty as their own support branches but, being that there's a git flow hotfix finish <version> subcommand but no git flow support finish <version> subcommand, such a hotfix branch is at greater risk of being accidentally finished, especially by a contributor who's unaware of your non-standard usage of it, than an explicit support branch that it was based on would be.

jkankiewicz avatar May 23 '18 20:05 jkankiewicz

I have the same proble. I cannot create hotfix form tag and this is required for me. I hope the team better the functionalitty

joxpg avatar Jun 03 '20 23:06 joxpg

I have the same proble. I cannot create hotfix form tag and this is required for me.

@joxpg, what's stopping you from first creating a support branch from that tag and then creating a hotfix branch based on that support branch?

I hope the team better the functionalitty

@joxpg, I wouldn't hold my breath because the functionality is already there, you're just skipping a step.

jkankiewicz avatar Jul 16 '21 20:07 jkankiewicz