Is there a way to control the order of branches shown in the graph in SourceTree?
Asked by matt_h:

I'm using GitFlow, and it sure seems like it would be a more intuitive ordering of the lines in the graph in SourceTree if the left-most line were always 'master', after that any 'hotfix' branches, then the 'release' branch (if present), then 'develop', followed (right-most) by any 'feature' branches.

I know this is a trivial benefit that would probably require significantly complicated programming on Atlassian's part and is therefore probably not worth the effort. However, it would be awfully nice, so it seemed worth asking just in case there is already some way to achieve this result (or something similar).


Answers:
author: Johannes Kilian
body: Your request would make sense, if gitflow would be the "one-and-only" branching model. If this ever would be implemented (which iI doubt), it should be optional - as there a few other branching models (and as some people might already be comfortable with the current situation :wink:)

SourceTree uses the common way of visualizing git-logs. The dynamic ordering of branches has been asked and discussed here on this site many times already.

You might have a look here:

* <https://answers.atlassian.com/questions/309593>
* <https://answers.atlassian.com/questions/310287>
* <https://answers.atlassian.com/questions/271836>
* ...

comments: author: matt_h
body: That makes sense, thanks. And I agree: it should be optional. Maybe a simpler request would be to let people define some strings to match against to control the colors of the various branches. For example, I could then set SourceTree to always make the "master" branch blue, and any branches starting with "feature" yellow, etc. Anyway, thanks for the explanation and links.


author: Tim Crall
body: Sure, it should be optional, but I think that putting the master branch always on the left would be useful for GitHub Flow, too. I'm not sure what strategies is would be harmful to


author: Johannes Kilian
body: git does not have any preferred branch - any branch is equivalent. Even master is not an extraordinary branch - it has its extraordinary meaning only by convention. The main branch has not to be named "master" - If I establish (only by personal convention) to have a branch named "Garbage" to be the main branch, branch "master" has not even to be available.

So I think it would be better not to have the branch named "master" to be the main branch, but rather to have a possibility in SourceTree to define the Standard-Branch. This standard branch should be treated specially (for example: to be configurable to be shown "always on the left" in the graph - but this should be optional)

BTW: BitbucketServer allows to define a "Standard Branch" per repository


author: ivangretsky
body: Can we achieve custom sort oder with **git branch --sort** somehow?SO it can be easilly adjusted?


author: ivangretsky
body: That is a wonderfull suggestion. There already is an option to choose branch odering. But gitflow ordering is not in the list. As SourceTree supports gitflow workflow it would be nice to make it look as it is natural to the methodology. Please consider implementing it!


author: troy harvey
body: This. Due to 3rd party repo integrations, much of the Git workflow is migrating to feature branching of some flavor.

Master is the de-facto branch in these workflows. Having it float all over the place is hard to manage.


author: Tim Crall
body: I wish it existed as an option, too. But I think you hit the nail on the head in terms of coding complexity to payoff, from Atlassian's point-of-view, because SourceTree pretty much just uses git's branch graphing logic without altering it, and to git a branch is a branch is a branch.  

Still, if you want to make the suggestion to Atlassian, the proper place to do that is jira.atlassian.com - where I expect you might find existing feature requests you could vote for.


Tags: graph