Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell TeamCity to treat merges as a single commit when working with git?

We recently moved from SVN to git. We work with a main "release" branch (master), and feature branches for every feature a dev is working on. In TeamCity we have a project for every feature branch, and of course a project for the master.

When we worked with SVN, whenever someone merged from master to his feature branch or vice-versa, the merge was treated by TeamCity as one commit. Now, with git, every merge causes TeamCity to show all of the commits that came with this merge.

This causes some problems, for example when someone merge from master to his feature branch, and now his TeamCity project shows "283 pending changes" due to that merge, if builds fail, the authors of these changes will be notified, as if they did these changes on the feature branch.

Is there a way to tell TeamCity to treat git merges as single commit?

We could solve it using squashed merges but that's something we would really like to avoid.

like image 491
yellowblood Avatar asked Dec 14 '12 10:12

yellowblood


People also ask

How do I commit changes after merging?

Go to "Team Explorer - Home" => Settings => (Git) Global Settings and toggle "Commit changes after merge by default." checkbox and Update.

Does merging create a commit?

Merging your branch into master is the most common way to do this. Git creates a new commit (M) that is referred to as a merge commit that results from combining the changes from your feature branch and master from the point where the two branches diverged.


1 Answers

I'm pretty sure this is the same issue that we had a few days ago, but vice-versa. We merged a dev branch into master, which caused TC to attempt to build each and every check-in that was part of the merge. Obviously not what we wanted.

To fix it, keep the Trigger build on each check-in option unchecked in the Build Trigger.

You get the full change history from the source branch, but TeamCity will only build the destination branch using the latest merged code. If that build fails, the merger should be the only one notified.

like image 80
Jaz Lalli Avatar answered Sep 21 '22 11:09

Jaz Lalli