<p>Finally I have resolved it with the help of "strategy of choosing what to build" with "Default behavior" for each branch.</p>

CC BY-SA 3.0
2018-04-06T10:27:06.127Z
Please elaborate your answer. Your answer will help others as well, so adding more explanation and a screenshot always helps :)
Vish
CC BY-SA 3.0
2018-04-05T20:17:55.947Z
2018-04-05T20:17:55.947Z
user541
<p>I am using Jenkins2 and GitHub plugin for triggering <strong>Push</strong> events.</p>

<p>I have the next service (Jenkins Github): <a href="http://myjenkinsmaster/github-webhook/" rel="nofollow noreferrer">http://myjenkinsmaster/github-webhook/</a></p>

<p>I also have 3 branches: <code>dev</code>, <code>stage</code>, <code>master</code> which need to be built.</p>

<p>But I require only the branch with changes to be built. </p>

<p>For example if changes were pushed to <code>dev</code>, only <code>dev</code> branch will be built, and others ignored. </p>

<p>However, Jenkins builds all 3 branches which I specified in branch field in job config. </p>

<p>How can I achieve a Jenkins build that builds only the branch where changes were pushed?</p>

CC BY-SA 4.0
2018-06-06T14:22:17.620Z
Do you use pipelines for jenkins jobs?
Here_2_learn
<jenkins><jenkins-plugins><github>
Github plugin triggering to push event only for changes in specific branches
user541
# Github plugin triggering to push event only for changes in specific branches

(Asked by: username_0 on 2018-04-05)

I am using Jenkins2 and GitHub plugin for triggering **Push** events.

I have the next service (Jenkins Github): <http://myjenkinsmaster/github-webhook/>

I also have 3 branches: `dev`, `stage`, `master` which need to be built.

But I require only the branch with changes to be built.

For example if changes were pushed to `dev`, only `dev` branch will be built, and others ignored.

However, Jenkins builds all 3 branches which I specified in branch field in job config.

How can I achieve a Jenkins build that builds only the branch where changes were pushed?

**Tags:** jenkins, jenkins-plugins, github

> **Comments:**
> **username_1**: Do you use pipelines for jenkins jobs?  

---

## 1 answers

### Answer by username_0 on 2018-04-05. Score: 1

Finally I have resolved it with the help of "strategy of choosing what to build" with "Default behavior" for each branch.

> **Comments:**
> **username_2**: Please elaborate your answer. Your answer will help others as well, so adding more explanation and a screenshot always helps :)  

---

