Enforcing branch names using Stash/Sourcetree and the Branching Model.

Mark Gillespie March 4, 2014

We are quite new to GIT/Stash but so far it's all going very well. We have out workflow and branching model defined.

Today we enabled the Branching model in Stash, and the expectation is, that Sourcetree/GIT would reject branch names that don't conform to this pattern if developers tried to push them. This doesn't seem to be the case. Developers can create branches without a prefix or with some other prefix. Have I mis-understood something?

Our branching model looks like this:

Branching Model

2 answers

1 vote
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2014

The branching model in essense is just a model/template to use. It is not enforcable without add ons in Stash (https://developer.atlassian.com/stash/docs/latest/how-tos/responding-to-application-events.html).

Mark Gillespie March 4, 2014

The wording by Atlassian suggests that it enforces it..

  • "guide your developers into making consistent naming decisions when creating branches."

It's not really doing anything active at all. Infact since switching it on, we havn't really noticed any differences. I guess the change only applies if you create branches from Stash or JIRA. Is this the point of it?

Roger Barnes
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 5, 2014

Hi Mark,

Tim is correct, currently the branch model is not enforced, but it can be by way of add-ons.

For now this means that the current out-of-the-box experience is that people using create branch from within JIRA and Stash will get the benefit of a branch model's guidance, but no one is prevented from naming new branches however they like.

Encouraging a social standard seems to work quite well for many, but I can appreciate that some projects need more restrictive flows (even in a distributed world). We are open to suggestions on where we can take workflow automation and management in the future in a way that works for most teams.

Deleted user March 10, 2014

Is there an already existing add-on which can do this?

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2014

Your branching model is called "Git Flow" is SourceTree. SourceTree will not import the settings from Stash, but the first time a developer hits the "Git Flow" button, they will be asked to enter the same thing.

After the first time, you can the branching model can be enforced IF your devs only create branches with the Git Flow button. Doing so when development is checked out will ask if they are creating a feature, hotfix, or release, and will automatically prepend the selected prefix to whatever name they choose for the new branch. Hitting Git Flow while in a feature, hotfix, or release branch will prompt the user to "finish", which merge that branch into the appropriate other branches (develop for feature, develop and master for hotfix and release).

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2014

After looking over your screenshot once more, it is worth pointing out that Git Flow doesn't support a "bugfix" branch.

Mark Gillespie March 4, 2014

We aren't using Gitflow, We started out down that route, but it's not really correct for us.

We now instruct developers to use the Branch and Merge buttons NOT the GitFlow one. However nothing actually guides them into making the right branch names...

Mark Gillespie June 9, 2014

In the end, we have shown them how easy it is to create the branch directly from JIRA (with the Stash Integration), they now all use that, so the branching naming isn't so much of a big deal anymore.

I'm sure there will always be one smartass that wants to do something different however, like create their branches using GIT CLI.....

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events