Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SourceTree: How to create multiple hotfix branches with Git Flow

How can I create a second hotfix branch in Sourcetree when one already exists? Whenever I try to it tells me to finish my current hotfix first. Any way to have multiple hotfix branches?

like image 549
Andrew Avatar asked Sep 26 '17 19:09

Andrew


People also ask

How to initialize Git-flow and Sourcetree?

It initializes an empty GIT repository. Git-flow also has to be initialized. This is done via this Terminal command: Or by just clicking on the Git Flow button in the SourceTree toolbar. In any case you'll be then presented with some options (branch names, prefixes) where you just leave default values for each of them.

How does Sourcetree handle hotfix changes?

The SourceTree website states: Once you’ve made your changes, the hotfix branch is then merged back into both the master branch (to update the released version) and the development branch (to make sure the fixes go into the next release too)

What branch structure should I use for Git-flow?

The general idea of git-flow is to use the following branch structure in your repository: 1. Development branch (usually called ‘develop’)

How do I merge a feature branch in Sourcetree?

Go back to SourceTree and double-click on the develop branch. In the toolbar click on Pull so you download the new version of develop branch. If you click on History tab, you'll see how a line that represents the feature branch merged into the develop branch. Double-click on the feature branch again.


2 Answers

This command will allow it:

git config --global gitflow.multi-hotfix true

like image 20
jvoigt Avatar answered Oct 26 '22 16:10

jvoigt


Ok figured it out. Sourcetree by default doesn't allow you to create more than one hotfix branch at a time using their UI/Git Flow. It wants you to "Git Flow > Finish" the first one before making a new one.

But you can create a second hotfix anyways...

Permanent solution for this repository

  1. in Sourcetree click Terminal
  2. git config --add gitflow.multi-hotfix true

Now you can as per usual: Git Flow > Start New Hotfix

Temporary solution (allow it just this one time)

  1. in Sourcetree click Terminal
  2. git checkout -b hotfix/my_new_hotfix master

Now you have a new hotfix named my_new_hotfix

like image 60
Andrew Avatar answered Oct 26 '22 17:10

Andrew