How a bot can reduce pull request merges in the ASP.NET Core repo

Wednesday, May 29, 2019 15 Comments

When a contributor submits a pull request to a repository, this is a gift to an open source maintainer. But it can also contain a big challenge if there are merge conflicts.

A merge conflict indicates that the contributor changed files that others have changed in the main branch. When you attempt to merge two branches where people changed the same, Git attempts to merge those changes cleanly.

However, it’s not always possible for Git to reconcile those changes, resulting in merge conflicts. In those cases, it’s up to the maintainer to manually and painstakingly merge the changes. Or, as is often the case, they’ll ask the contributor to do it and push to the branch again. This is a lot of time-consuming tedious work.

mergedroid is a small GitHub app that connects to your repo and tries to automatically resolve merge conflicts in pull requests that GitHub can't. This saves tons of manual work. And it seems mergedroid can do a pretty good job, as the results in the ASP.NET Core repo show:

According to these results, almost 20% of the pull requests that required manual intervention, could have been automated by mergedroid.

Also, if you look at the file level, up to 45% of the files with merge conflicts could be automatically merged using a tool like gmaster Git GUI (this is not the job of mergedroid but its Git GUI evil twin. This is because the "bot" in mergedroid must solve the entire branch or nothing, even if just 1 of 99 files can't be automatically merged. When that happens, human interaction is required and then a good merge tool helps).

Do you want to deep inside how one of those merges that can be automated looks like? Keep reading.

A cross-file merge successfully automated by mergedroid

Let's go for a real case.

This was a merge that happened between these two commits:

Basically, as the comment of 13d9774e7afe5bcdc7ed9186e4815d5b3aed429c says:

Merge remote-tracking branch 'origin/release/2.1' into release/2.2

This was a manual merge. Here’s a visual representation of what happened...


  • src/theirs is the 2.1 branch.
  • dst/yours is the destination, the 2.2 branch.
  • base is the common ancestor of the two branches.

The method GetNextPort in TestUriHelper.cs was modified on the 2.1 branch . At the same time, the same method was also modified on the master branch, but also moved to a different file (TestPortHelper). Uh-oh! This results in a conflict that Git doesn’t know how to resolve.

Note: this actual diagram showing how the method was moved to a different class/file and modified in parallel is what the gmaster GUI shows when you run a merge.

Let’s take a closer look at the changes in each branch. This is the change that was done in the 2.1 branch:

This shows that the author deleted a comment inside of the method body and added a comment just before the method.

These are the changes made in parallel in master. Remember, the method was moved to a different file too:

It is exactly the same change, but applied to a different file since the method was moved.

Git doesn’t have semantic understanding of code, so it doesn’t realize that this change represents a method being moved with a comment change. It just sees the fact that the text here has conflicting changes and reports a merge conflict. The good news is mergedroid does understand code and can merge this automatically!

What else might have happened

In this case the method was modified in exactly the same way in both contributors. In practice, you often run into situations where:

  • The method was renamed after being moved to the new file.
  • And only one of the contributors modified the actual body.

mergedroid can still handle that situation with an automatic and correct merge.

How the GUI can help?

Well, suppose that both contributors moved the method to two different files. This is what we call a "divergent merge case". Even if mergedroid can't solve this because it needs human intervention, gmaster, the GUI that shares the same semantic technology, can help you detect and fix this type of conflict that bare Git can't, because it doesn't look for methods moved across files during merge as gmaster and its semantic merge tech do.

We develop gmaster, a Git GUI with semantic superpowers. It parses the code to really understand how it was refactored and then diff it and merge it as a human would do, matching methods instead of lines.

If you want to try it, download it from here.

We are also the developers of SemanticMerge and Plastic SCM, a full-featured version control.


  1. You need to advertise on your homepage where to get support, preferably github perhaps? In any case gmaster doesn't install on my win10 machine. Installing at default location I got permission denied in the last step, running as admin and installing again results in the installer ending at "The parameter is incorrect".

  2. I always used to read smaller articles that as well clear their motive, and that is also happening with this post which I am reading at this place.
    Parallels Desktop Crack

    Crack Software

    Crack Software

  3. Hello, its nice article regarding media print, we all be aware of media is a fantastic
    source of facts.

  4. I have recently started a web site, the information you provide on this site has helped me tremendously. Thank you for all of your time & work.

  5. Admiring the hard work you put into your blog and detailed information you provide. Great read! I’ve bookmarked your site and I’m including your RSS feeds to my Google account.

  6. I am really grateful towards the owner on this web page who has
    shared this enormous post at here.

  7. Traditional bookstores have always existed on high streets, but in the digital age, the internet is proving to become a serious competitor to traditional brick and mortar stores. This article examines both sides of the coin and provides an appropriate insight into the phenomenon of shopping of books online. 메이저사이트추천

  8. The Eight-Wheel Classic - TITIAN Arts
    The eight-wheel classic bicycle is available in six apr casino sizes. The Bicycle Wheel titanium flat iron is a classic bicycle made in USA, but there are three variations in

  9. Postingan poker online terbaik serta terpercaya di indonesia

    Kala kamu jalani dewapoker satu taruhan dengan benar dan cocok nyatanya. Sebagian pemain yang menginginkan bermain poker88 asia mesti mendapatkan satu. Diantara keuntungan yang begitu besar dalam bermain lapak303 bukan? Jadi kala tersebut kamu yang menginginkan rasakan keuntungan. Dalam bermain mesti dengan benar dan cocok dalam jalani satu taruhan karena memanglah. Umumnya game judi dengan bandar online sendiri pula hendak. Buat kamu natural bermacam - macam keuntungan dominobet yang dapat kamu nikmati dan mesti kamu.

  10. This is a good tip particularly to those fresh to the blogosphere. Brief but very accurate information… Many thanks for sharing this one. A must read post! 먹튀검증

  11. Way cool! Some very valid points! I appreciate you penning this article plus the rest of the site is also really good. 온라인경마