Sean M. Sean M. - 2 months ago 18
Git Question

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?

Answer

Shut Sourcetree, and edit the file .git/config 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