Maiao:适用于 GitHub、GitLab、Gitea 等平台的 Gerrit 风格代码审查工作流
Maiao: Gerrit-style code review workflow for GitHub, GitLab, Gitea, others

原始链接: https://github.com/runetes/maiao

**Maiao**(目前作为社区分支维护于 `runetes/maiao`)是一款为 GitHub、GitLab、Gitea、Forgejo、Bitbucket 和 Cursor Origin 等主流 Git 托管平台引入 Gerrit 风格堆叠式拉取/合并请求(stacked pull/merge requests)的工具。 通过允许开发者将大型功能拆分为多个小的顺序提交,Maiao 会为每个提交创建一个独立且具有依赖关系的 PR/MR。这不仅实现了更快速、更专注的代码审查,还能保持项目历史记录的整洁与逻辑性。 **主要功能:** * **自动堆叠:** 管理父子依赖关系,并可在可用时与原生堆叠功能(如 GitHub Stacks)集成。 * **工作流效率:** 支持 `git commit --fixup` 以简化修订,并在单个 PR 合并后自动对堆叠进行变基(rebase)。 * **易用性:** 从远程 URL 自动识别 Git 提供商,并使用 Gerrit 风格的 Change-ID 来追踪提交。 * **通用性:** 跨多平台工作,为支持的提供商提供原生 API 集成,并在必要时提供基于分支的堆叠回退方案。 Maiao 旨在简化复杂开发工作流,使“堆叠式差异”(stacked diffs)方法论能够惠及更广泛的开发者与平台。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Maiao:适用于 GitHub、GitLab、Gitea 等平台的 Gerrit 风格代码审查工作流 (github.com/runetes) 6 点,由 zdw 1 小时前发布 | 隐藏 | 过往 | 收藏 | 讨论 | 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 申请 YC | 联系 搜索:
相关文章

原文

License GitHub all releases downloads

Note: This is a community fork of adevinta/maiao. The original maintainers are no longer at Adevinta and the upstream repository is no longer actively maintained. This fork continues development under runetes/maiao.

Gerrit-style code review workflow for GitHub, GitLab, Gitea, Forgejo, Bitbucket Cloud, and Cursor Origin

Maiao brings the power of stacked pull requests (or merge requests) to your git hosting provider, enabling you to break large features into small, reviewable commits where each commit becomes its own PR/MR.

Maiao provides the git review command that:

  • Creates one PR/MR per commit in your branch
  • Stacks PRs/MRs automatically with proper parent-child dependencies
  • Registers native stacks when available (GitHub Stacks, GitLab auto-detected stacks)
  • Manages fixups elegantly using git commit --fixup
  • Tracks commits via Change-IDs (using the Gerrit commit-msg hook)
  • Auto-rebases your stack when PRs/MRs get merged
  • Auto-detects your provider from the remote URL
Provider PR/MR type WIP/Draft Native stacks
GitHub Pull Request API field Yes (explicit registration)
GitLab Merge Request Draft: title prefix Yes (auto-detected from target branch, up to 20 MRs)
Gitea Pull Request WIP: title prefix No
Forgejo/Codeberg Pull Request WIP: title prefix No
Bitbucket Cloud Pull Request Not supported No
Cursor Origin (beta) Pull Request API field Yes (parentPullNumber)

Maiao auto-detects the provider from your remote URL for known hosts (github.com, gitlab.com, codeberg.org, bitbucket.org, origin.cursor.com). For self-hosted instances, it prompts on first use and saves the choice to git config maiao.provider.

# Make multiple commits
git commit -m "Add user authentication"
git commit -m "Add authorization middleware"
git commit -m "Add admin endpoints"

# Create stacked PRs/MRs for all commits
git review

Result: Three PRs/MRs created and stacked:

  • PR #1: Add user authenticationmain
  • PR #2: Add authorization middleware → PR #1
  • PR #3: Add admin endpoints → PR #2
  • Granular Reviews: Each commit reviewed independently for faster, focused feedback
  • Clear History: One logical change per PR/MR maintains clean git history
  • Easy Fixups: Address review feedback with git commit --fixup <sha>
  • Automatic Stacking: Tool manages PR/MR dependencies automatically
  • Native Stacks: Integrates with GitHub Stacks and GitLab's auto-detected stacks
  • Merge Detection: Stack updates automatically when PRs/MRs merge
  • Rebase Integration: Handles upstream changes gracefully
  • Multi-Provider: Works across GitHub, GitLab, Gitea, Forgejo, Bitbucket Cloud, and Cursor Origin

Maiao treats GitHub native stacks as a progressive enhancement. When two or more PRs are pushed, Maiao probes the Stacks API (cached for 24 hours) and registers the PRs as a stack if supported. On older GitHub Enterprise instances the feature is silently skipped — branch-based stacking still works as before.

# Control via git config (default: auto)
git config maiao.useNativeStack auto   # use when available, skip otherwise
git config maiao.useNativeStack true   # always register; warn if unavailable
git config maiao.useNativeStack false  # disable entirely

Learn About Stacked Diffs

Maiao implements the stacked diffs methodology. Learn more:

As Maiao encourages users to create smaller and nicer commits in their pull requests, it has been given the name of a tiny island:

Contributions are welcome! See CONTRIBUTING.md for details.

MIT License - see DISCLAIMER.md for details.

联系我们 contact @ memedata.com