About Talks Articles

Automatic Merge of Pull Requests

2 min read

After using Azure DevOps for a while, I am totally sold on its Auto Complete feature for pull requests. While it does not apply universally, I do believe that any development process should be at the level where merging pull requests, or generalizing it, integrating all forms of contribution, should be as automatic and as hassle-free as possible.

If you are not familiar yet with Azure DevOps, it is basically a pay-as-you-go service for code repositories, automatic build runs, task tracker, artifact management, etc. Azure DevOps is pretty much comparable to various other similar services, such as GitHub, GitLab, Bitbucket, and many others. Note that although it bears the name Azure, you do not need to use any other Azure services to be able to take advantage of Azure DevOps offering (similar to how you can use Google Maps but without the need to store your files at Google Drive or host your email with Gmail).

One feature that makes Azure DevOps (at the time of this writing) unique compared to others is its ability to mark a PR (pull request) as Auto Complete. To do this, go to the sidebar and choose Branches (under Repo menu group). Once the branch list is displayed, hover on e.g. master and pick its context menu (rightmost three-dot menu) and choose Branch policies. Pick some settings which suit your need. Make sure to customize the Build validation, this is done by adding a simple build policy.

Enable auto completion

Now, whenever you create a pull request, there is a noticeable blue button, Set Auto complete, on the pull request page. Basically what it does is the automatic merging of the pull requests of two conditions are fulfilled:

There are also a few tweaks possible. For instance, you have the option to squash the branch, rebase and fast-forward, etc. Even better, there is an option to automatically delete the branch once it is merged, which can really help to reduce clutter.

Removing the manual step of merging an approved pull request will eliminate one more thing than we, human being, need to be involved with. Who would not enjoy less amount of cognitive load? I hope other services such as GitHub, GitLab, Bitbucket, and many more will follow suit and implement the same feature!

Related posts:

♡ this article? Explore more articles and follow me Twitter.

Share this on Twitter Facebook

comments powered by Disqus