TeamCity has a build feature Automatic merge. It allows you to make merge commit changes to a specific branch (integration). Every time someone makes a commit that passes all the tests, this commit can be automatically poured into the integration branch and, if it didn’t work out, give an error that conflicts occurred during the merge that will allow the team to react promptly.

Question: What to do after it turned out that conflicts occurred during the merger?

In theory, if a programmer works in a feature branch, he must post a branch on himself and resolve conflicts. Only this is not a developer. In the development can not be machine merzhit. I can not figure out how this feature correctly zayuzat. What are use-cases?

  • one
    когда кто-нибудь делает коммит - just a commit, not a merge-request? Not always commit means that the feature is complete and ready for testing. If the commit is automatically merged, it will encourage developers to commit less often (or not to push on the remote), which is fraught with loss of work results. - Nick Volynkin
  • The @NickVolynkin idea is to detect conflicts as early as possible. Automatic Merzh goes to a separate branch in no way associated with the development, so this does not affect the work process in any way. It is quite possible that I misunderstood something and use this tool in the wrong way. Hence the question :) - Andrey Kolomensky
  • one
    a merge conflict is a kind of regular situation. Do you want the developer to rebuy every time? What is the purpose? - Nick Volynkin
  • one
    @ Onedev.Link, doesn’t the integration testing system send notifications of failure? Why to somewhere inject the obviously unworkable feature-branch? After all, every successful merging of such a branch increasingly “breaks” the integration branch. - ߊߚߤߘ
  • one
    @ Chad is quite controversial. It is clear that if conflicts occur on every second merzh, then there is a problem. But from time to time - this is normal. And if you split up and set tasks so that they do not overlap in code, then it is very likely that you are involved in micromanagement. - andreycha

1 answer 1

I see two options for using automatic merge:

  • If you use feature / bugfix brunches, but there are no pull requests / integration branches in your process, i.e. You are ready to immediately merge into the master. This allows you to achieve isolation changes and their automatic integration. (Although to me personally, such a model seems doubtful, especially for fairly large changes, because it forces you to make local commits without pushing, and this can be fraught.)
  • If you use an integration brunch, where features / bugfix brunches are flowing in. Changes are tested, and then merged into the master.

In the second case, the integration brunch is essentially a copy of the wizard with the added changes. Therefore, when pouring into the integration brunch, conflicts can arise for two reasons:

  • changes conflict with master
  • changes conflict with changes from another feature / bugfix brunch, which were merged into the integration branch, but have not yet entered the master

In both cases, to settle the conflict is sufficiently merge from the integration branch. The first case is obvious - there are conflicting changes from the master in the integration branch as well. The second case is also obvious - without the green integration branch, the work will not go further. And here there is a standard rule - whoever commits the last one, he merges :).


the idea is to detect conflicts as early as possible.

Then maybe you should just add the merge from the wizard to the feature / bugfix branch for each build? If we talk about TeamCity, then the first step of the build is to add the following code:

 git remote set-url origin %repo_url% if NOT %teamcity.build.branch.is_default%==true git fetch if NOT %teamcity.build.branch.is_default%==true git merge origin/master 

It is guaranteed to detect conflicts immediately. The master will always be "green", you will not get conflicts due to the fact that someone has flooded the conflicting changes in the integration branch.