Unable to create a new hotfix in SourceTree gitflow
Asked Answered
E

5

13

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?

Extinctive answered 4/4, 2015 at 16:3 Comment(0)
R
4

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

Rayraya answered 4/4, 2015 at 22:21 Comment(3)
when I create the hotfix branch and then I need to finish it, do I need to delete it?Extinctive
Yes, ideally you need to delete it after you merge back into masterRayraya
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.Portraitist
C
31

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.

Cleodel answered 8/2, 2018 at 13:21 Comment(0)
R
4

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

Rayraya answered 4/4, 2015 at 22:21 Comment(3)
when I create the hotfix branch and then I need to finish it, do I need to delete it?Extinctive
Yes, ideally you need to delete it after you merge back into masterRayraya
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.Portraitist
F
3

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
Ferity answered 16/12, 2018 at 6:5 Comment(0)
B
0

You need to delete the last hotfix that You've created (the branch named only with hotfix without the slash), before creating a new one. And you'll receive the following message when you try to create the new hotfix (if you're on the command prompt):

Switched to a new branch 'hotfix/XXXXX'

Summary of actions:
- A new branch 'hotfix/XXXXX' was created, based on 'main'
- You are now on branch 'hotfix/XXXXX'

Follow-up actions:
- Start committing your hot fixes
- Bump the version number now!
- When done, run:

     git flow hotfix finish 'XXXXX'

Run the following command to be able to use multi hotfix branches, if necessary:

git config --add gitflow.multi-hotfix true
Boa answered 25/12, 2021 at 10:48 Comment(0)
C
-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

Casi answered 4/4, 2015 at 18:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.