简体   繁体   English

GitHub/Azure Repos 上的服务器端自定义 git 合并驱动程序

[英]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.我有一个用于 git 的自定义合并驱动程序,可帮助合并数百名工程师共享的大型 monorepo 中的锁文件 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).因为锁文件经常变动,所以在审查 PR 时这些文件导致合并冲突的情况并不少见(因为进程)。 This means the PR branch should be updated manually after resolving conflicts on these lockfiles locally using this merge driver.这意味着在使用此合并驱动程序在本地解决这些锁定文件上的冲突后,应手动更新 PR 分支。

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(或Azure Repos )上配置这个合并驱动程序,这样这个驱动程序将用于合并 PR 分支(而不是默认的自动合并)?

GitHub doesn't provide the ability to use custom merge drivers, and I'm not aware of any platform that does. GitHub 不提供使用自定义合并驱动程序的能力,我不知道有任何平台可以。 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.此外,GitHub 上的合并是使用 libgit2 完成的,它旨在在计算合并时快速高效,并在合并不可能时提前中止,而自定义 Git 合并驱动程序不会提供这些功能。

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 Actions 操作找到某种方法来自动合并获得满意批准的拉取请求,该操作使用您的自定义合并驱动程序,然后将其推送到存储库。 GitHub will show the branch as merged and close the pull request accordingly in that case.在这种情况下,GitHub 会将分支显示为已合并并相应地关闭拉取请求。 That's the closest you're likely going to be able to get, though.不过,这是您可能获得的最接近的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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