简体   繁体   中英

Server-side custom git merge driver on GitHub/Azure Repos

I have a custom merge driver for git that helps merge lockfiles in a large monorepo shared by hundreds of engineers. Because lockfiles churn quite frequently, it's not uncommon for these files to result in merge conflicts while a PR is being reviewed (because master progresses). This means the PR branch should be updated manually after resolving conflicts on these lockfiles locally using this merge driver.

Question: Is there a way to configure this merge driver on GitHub (or Azure Repos ) on the server-side such that this driver would be used for merging PR branches (as opposed to the default automerge)?

GitHub doesn't provide the ability to use custom merge drivers, and I'm not aware of any platform that does. Part of the reason for this is that custom merge drivers can execute arbitrary code and most hosting platforms are not interested in executing arbitrary code on behalf of users.

In addition, merges on GitHub are done with libgit2, which is designed to be fast and efficient when computing the merge and to abort early if the merge is not possible, and custom Git merge drivers wouldn't provide those features.

You could find some way to automerge pull requests that are approved to your satisfaction using a custom GitHub Actions operation that uses your custom merge driver and then pushes it to the repo. GitHub will show the branch as merged and close the pull request accordingly in that case. That's the closest you're likely going to be able to get, though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM