Reputation: 6076
Our company had been using a git branching strategy that kept a long-running sprint work branch around that looked something like this:
master
\
Sprint
\
Feature1
Feature2
With the current sprint, we switched to having a new branch with a new name for each sprint:
master
\
Sprint123
\
Feature1
Feature2
With this change some pain points arise:
I've been through the VSTS documentation, but I feel like I've missed something on how to set this up to have a new branch per sprint (which is in line with VSTS branching strategy documentation).
So, the questions are:
Our expectation was that the branch that triggers the build is the one that is built. Is this possible?
What is the recommendation for setting branch policy each time a new branch is created off of master? Should we just expect that we will have to configure all of the settings manually every time?
Upvotes: 0
Views: 2233
Reputation: 937
We've published guidance on Git branch strategy. The sibling answer which points at TFVC is incorrect.
We don't recommend long-running development branches for most teams. Instead, keep a clean master and use short-lived topic branches. Then, you won't need to keep creating and deleting policies, build definitions, etc.
If you must keep using long-lived branches for some reason, consider using slashes in the names of branches, e.g. sprints/s100
. We have a REST API already (and soon, admin UI) to set policies on a prefix-matching basis, stopping at /
s. So, you could set up branch policy on sprints/
and it would get automatically applied to sprints/s100
, sprints/s101
, etc.
Upvotes: 3
Reputation: 38106
The recommended branching strategy is always use the same branch even for new sprints. As this article, you can always use development
branch for different sprints.
Of cause, you can use your branching strategy if the codes are quite different between two sprints. But the disadvantages as:
sprint*
, it’s not good to trace the whole project versions easily.Finally, for your questions (if you still need your current strategy):
Sprint*
in build definition Triggers Tab, then your new created branches Sprint### will also suitable for CI build. And get sources step for build definition won’t affect your CI build, the repo and branch select only for manually queue build.Upvotes: 1