10

enter image description here

Hello this is my git workflow. I'm trying to create by using Sourcetree a new hotfix. Unfortunately I get this error:

There is an existing hotfix branch (issue-#001). Finish that one first.

I have already finished the issue-#001. Why I'm unable to create a new one?

Andrew
  • 13,934
  • 8
  • 78
  • 93
Mazzy
  • 11,255
  • 34
  • 110
  • 179

4 Answers4

21

There is a configuration option that you can set if you want multiple hotfixes.

git config --add gitflow.multi-hotfix true

This would allow multiple hotfixes, but by default it's not allowed. You can add this option per repository or globally.

iAmrSalman
  • 481
  • 5
  • 8
3

You need to delete the existing branch with the same name if you want to create it again . Git would not allow you to create branches with duplicate names.

You can also try to update the hotfix branch by merging in the latest master and then work on the updated branch

Biswajit_86
  • 3,400
  • 2
  • 19
  • 36
  • when I create the hotfix branch and then I need to finish it, do I need to delete it? – Mazzy Apr 05 '15 at 10:50
  • Yes, ideally you need to delete it after you merge back into master – Biswajit_86 Apr 05 '15 at 15:41
  • 1
    By default, Gitflow limits only **one** existing hotfix branch, so if all hotfixes get deleted, no matter with the same name or not, things can go through. – themefield Jul 13 '18 at 21:52
2

Check for existing hotfixes:

git branch | grep hotfix

It gives you the full name of your hotfix branch, in your case issue-#001. Remove the branch if not needed anymore:

git branch -D issue-#001

To check what the issue-#001 was about, run

git stash
git checkout issue-#001
git status
git diff
wscourge
  • 8,047
  • 10
  • 43
  • 66
-1

looks like you already have hotfix with this name check to verify:

git branch 

you should see hotfix/XXXX what ever name you use

CodeWizard
  • 92,491
  • 19
  • 110
  • 133