Mazzy
Mazzy

Reputation: 14227

Unable to create a new hotfix in SourceTree gitflow

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?

Upvotes: 13

Views: 18243

Answers (5)

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

Upvotes: 0

wscourge
wscourge

Reputation: 11311

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

Upvotes: 3

iAmrSalman
iAmrSalman

Reputation: 621

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.

Upvotes: 31

Biswajit_86
Biswajit_86

Reputation: 3739

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

Upvotes: 5

CodeWizard
CodeWizard

Reputation: 142572

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

git branch 

you should see hotfix/XXXX what ever name you use

Upvotes: -1

Related Questions