<p>It's recommended that you use a convention of prefixing your grouped references (like branches) with "folder" prefixes.</p>

<p>For example, when you create sprint branches, create them with the names:</p>

<pre><code>sprints/sprint01
sprints/sprint02
sprints/sprint03
</code></pre>

<p>Then, configure your build trigger <code>Include</code> filters with this prefix:</p>

<p><code>sprints/*</code></p>

<p>... and then an <code>Exclude</code> filter for <code>master</code>, since by default it is also included.</p>

<p>Once configured, this should build only the sprint branch (topic branch) that was committed to.</p>

<p>Reference: <a href="https://docs.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=azure-devops&amp;tabs=designer" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=azure-devops&amp;tabs=designer</a></p>

CC BY-SA 4.0
2019-04-10T01:38:40.310Z
If i configure `sprints/*` and a developer make a push on the `sprint03`, will it build branches `sprint01` and `sprint02`?
Felipe Oriani
CC BY-SA 4.0
2019-04-10T01:51:06.907Z
@FelipeOriani No, it should only build sprint03 as the trigger should see the specific branch that triggered it that matches the wildcard.  I've only used similar wildcards when wanting to trigger builds when tags are created (`refs/tags/*`), but the filtering should be the same.  Test it out and report back.
Sumo
CC BY-SA 4.0
2019-04-10T00:18:31.483Z
2019-04-10T00:18:31.483Z
Sumo
<p>On the Azure DevOps, in we <code>git</code> we have a schema of branches where we create a branch per <code>sprint</code>, for sample:</p>

<ul>
<li>sprint01</li>
<li>sprint02</li>
<li>sprint03
...</li>
</ul>

<p>We keep the 3 last <code>sprint</code> branches, and in this case when I create the <code>sprint4</code> branch, we will drop the <code>sprint01</code>. Each sprint  We publish a version of our product every week. On the <code>build</code> pipeline definition on our project, we have defined the trigger to run over a push on the <code>sprint*</code> branch because we don't want to change the definition on each new version.</p>

<p>It works but it runs a build for each <code>sprint</code> branch and a release for each one. I would like to have just for that branch (with prefix <code>sprint</code>) that was pushed on the git. Is there any way to configure it?</p>

<p>My current configuration:</p>

<p><a href="https://i.sstatic.net/XJM2C.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/XJM2C.png" alt="enter image description here"></a></p>

CC BY-SA 4.0
2019-04-08T09:47:41.543Z
What do you mean "it runs a build for each sprint branch"?
Shayki Abramczyk
CC BY-SA 4.0
2019-04-08T12:25:15.993Z
For sample, If I have branches called `sprint01`, `sprint02`, `sprint03`, the trigger will run a build for each branch. I wish to run just for the branch that was pushed.
Felipe Oriani
CC BY-SA 4.0
2019-04-08T12:26:27.807Z
If you push from `sprint01` so 3 different builds will be executed? (3 build run in parallel?)
Shayki Abramczyk
CC BY-SA 4.0
2019-04-08T12:30:12.057Z
Yes, because I have configured `sprint*`. If I push sprint03 I wish to run just a build/release for this. I know I can configure a fixed branch, but we have a new sprint every monday, I would like to have this automatically.
Felipe Oriani
CC BY-SA 4.0
2019-04-08T12:34:57.513Z
I don't know if it is possible to configure.
Felipe Oriani
CC BY-SA 4.0
2019-04-08T12:38:47.363Z
I just tried it on my side, only 1 build run, with the branch where I did push. can you share screenshots from the summary page what happened when you push to specific sprint branch?
Shayki Abramczyk
CC BY-SA 4.0
2019-05-10T06:27:23.333Z
If I am getting your question correct, [This](https://docs.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=azure-devops&tabs=classic) might be useful.
Darshana Patel
<azure-devops><build-pipeline><release>
How trigger a build by a commit in a branch prefix?
Felipe Oriani
# How trigger a build by a commit in a branch prefix?

(Asked by: username_0 on 2019-04-04)

On the Azure DevOps, in we `git` we have a schema of branches where we create a branch per `sprint`, for sample:

* sprint01
* sprint02
* sprint03
  ...

We keep the 3 last `sprint` branches, and in this case when I create the `sprint4` branch, we will drop the `sprint01`. Each sprint We publish a version of our product every week. On the `build` pipeline definition on our project, we have defined the trigger to run over a push on the `sprint*` branch because we don't want to change the definition on each new version.

It works but it runs a build for each `sprint` branch and a release for each one. I would like to have just for that branch (with prefix `sprint`) that was pushed on the git. Is there any way to configure it?

My current configuration:

[![enter image description here](https://i.sstatic.net/XJM2C.png)](https://i.sstatic.net/XJM2C.png)

**Tags:** azure-devops, build-pipeline, release

> **Comments:**
> **username_1**: What do you mean "it runs a build for each sprint branch"?  
> **username_0**: For sample, If I have branches called `sprint01`, `sprint02`, `sprint03`, the trigger will run a build for each branch. I wish to run just for the branch that was pushed.  
> **username_1**: If you push from `sprint01` so 3 different builds will be executed? (3 build run in parallel?)  
> **username_0**: Yes, because I have configured `sprint*`. If I push sprint03 I wish to run just a build/release for this. I know I can configure a fixed branch, but we have a new sprint every monday, I would like to have this automatically.  
> **username_0**: I don't know if it is possible to configure.  
> **username_1**: I just tried it on my side, only 1 build run, with the branch where I did push. can you share screenshots from the summary page what happened when you push to specific sprint branch?  
> **username_2**: If I am getting your question correct, [This](https://docs.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=azure-devops&tabs=classic) might be useful.  

---

## 1 answers

### Answer by username_3 on 2019-04-10. Score: 0 | Accepted answer

It's recommended that you use a convention of prefixing your grouped references (like branches) with "folder" prefixes.
For example, when you create sprint branches, create them with the names:
sprints/sprint01
sprints/sprint02
sprints/sprint03

Then, configure your build trigger Include filters with this prefix:
sprints/*
... and then an Exclude filter for master, since by default it is also included.
Once configured, this should build only the sprint branch (topic branch) that was committed to.
Reference: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/ci-build-git?view=azure-devops&tabs=designer

> **Comments:**
> **username_0**: If i configure `sprints/*` and a developer make a push on the `sprint03`, will it build branches `sprint01` and `sprint02`?  
> **username_3**: @FelipeOriani No, it should only build sprint03 as the trigger should see the specific branch that triggered it that matches the wildcard.  I've only used similar wildcards when wanting to trigger builds when tags are created (`refs/tags/*`), but the filtering should be the same.  Test it out and report back.  

---

