Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename local GIT branch breaks Git Flow in SourceTree

While using SourceTree I renamed the two main local branches (master and develop).
However, when I now click on the Git Flow icon to start a new feature, it tells me that the repository needs to be initialized (even though it has been already been initialized).
Additionally, the REPOSITORY -> GIT FLOW -> INITIALIZE REPOSITORY menu item is greyed out.

I tried putting the names of the branches back and git flow works again!

So, how do I rename the branches and keep git flow working?

like image 267
Sean M. Avatar asked Jan 01 '26 15:01

Sean M.


1 Answers

Shut Sourcetree, and edit the file .git/config (within the repository) updating the [gitflow "branch"] section. The .git directory is sometimes hidden within file explorer.

The default will look something like this:

[gitflow "branch"]
master = master
develop = develop

And you should change it to match your new branch names, i.e.:

[gitflow "branch"]
master = yourNewMasterBranchName
develop = yourNewDevelopBranchName

Then restart SourceTree

like image 151
Russ Avatar answered Jan 03 '26 06:01

Russ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!