my-git

xirongMIT活跃维护

把 Git 工作流当作 AI 原生软件工程的变更控制手册,讲清 AI 编码场景下如何用分支、提交和评审流程管住代码变更。

Git as the control plane for AI-native software engineering | AI Native 软件工程的 Git 变更控制手册

v2.2.0发布于 2026-09-09 09:45 UTC7,403star2,469fork同步于 2026-11-10 17:33 UTC

怎么上手

由 README 提炼,执行前请确认
README 未说明
硬件要求按 README 说明

README 未说明

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

一份讲清 Git 原理与变更控制的 AI Native 软件工程手册,帮你在 AI 代劳命令时仍能判断改动是否可信

把 Git 工作流当作 AI 原生软件工程的变更控制手册,讲清 AI 编码场景下如何用分支、提交和评审流程管住代码变更。

核心能力

  • 用交互实验讲快照、对象图、引用与历史变化
  • 覆盖 AI 生成变更的 diff 审查与 commit 拆分
  • 提供 Stacked PR 与多 Agent worktree 协作方案
  • 给出分支保护、Rulesets、Merge Queue 治理路径
  • 附 PR、Review、Hotfix、AGENTS.md 等可复制模板

容易踩的坑

这是文档型仓库,不是可安装工具,无需构建或运行;交互学习内容托管在 GitHub Pages 在线访问,本地阅读需自行 clone 仓库;部分文章链接指向站外资源,需联网查看

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

4 个版本v2.2.0
  1. v2.2.0v2.2.0: Git Learning Labs and AI Collaboration Practices最新正式版2026-09-09 · 2026-09-09 09:45 UTC

    Highlights

    • Added a bilingual Git mental-model curriculum with ten topics, interactive explanations, and disposable-repository labs.
    • Added a knowledge map and an engineering-change course covering CI, background tasks, acceptance evidence, and incident recovery.
    • Fixed displayed recovery and storage commands and added regression tests that execute the displayed command sequences.
    • Updated PR and commit templates to separate AI participation, human review, verification evidence, and remaining gaps.
    • Expanded agent governance for untrusted inputs, submitted data, and changes to agent instructions or permissions.
    • Added reproducible AI collaboration metrics with explicitly synthetic examples; these are not claims about real team productivity.

    Validation and boundaries

    The release preparation passed the documentation/link checks, eight link-checker regression tests, and the complete Git learning lab suite. Real-reader trials remain pending. The documentation does not configure governance controls in a team's platform.

    Full release notes: English | 中文

    Full changelog

    AI assistance: OpenAI Codex was used to prepare the collaboration documentation and release materials.

  2. v2.1.0v2.1.0: AI Agent Governance and Conventions2026-06-11 · 2026-06-11 11:26 UTC
    查看更新说明

    This release covers AI agents as governed, first-class repository participants: how to govern them, and how to write conventions for them.

    Highlights

    • Added the AI Agent Governance guide: three agent identity models, permission scoping, PR approval rules, CI triggers with secrets isolation, and traceability, with hosted agent restrictions grounded in the official GitHub documentation
    • Added the AGENTS.md template, copyable into team repositories, with setup commands, required verification, boundary rules, commit conventions, and a mapping to tool-specific instruction files
    • This repository now follows its own recommendations: a root AGENTS.md, AI-assisted contribution rules in the contributing guides, and documentation checks that include AGENTS.md
    • Expanded Multi-Agent Branch Strategy with executable workflows: comparing experiment branches, integrating the winning solution, handling same-file collisions, and cleaning up losing branches
    • Expanded Stacked PR for AI-Generated Changes with native Git stack operations (--update-refs, rebase --onto, --force-with-lease) and Graphite CLI core commands
    • All content above is maintained as Chinese and English pairs

    Why This Release

    v2.0 set the direction toward AI-native development workflows, but agent governance and collaboration conventions were still missing.

    AI agents are already creating branches, opening PRs, and triggering CI. v2.1.0 upgrades them from diff generators to governed participants: maintainers get a governance configuration checklist, teams get a copyable AGENTS.md template, and developers get executable commands for multi-agent work and PR stacks.

    Full notes: English | 中文


    这个版本把 AI agent 当作仓库里的正式参与者来覆盖:怎么治理它们,怎么给它们写约定。

    主要内容

    • 新增 AI Agent 治理指南:agent 的三种身份形态、权限收紧、PR 审批规则、CI 触发与 secrets 隔离、可追溯性,托管 agent 的内置限制以 GitHub 官方文档为依据
    • 新增 AGENTS.md 模板,可直接复制到团队仓库,含环境命令、验证要求、边界禁令、提交约定,并附各工具配置文件对照表
    • 本仓库开始遵循自己倡导的约定:根目录新增 AGENTS.md,贡献指南补充 AI 辅助贡献规则,文档检查覆盖 AGENTS.md
    • Multi-Agent Branch Strategy 补齐可执行流程:对比实验分支、整合胜出方案、同文件冲突处理、清理落选分支
    • Stacked PR for AI-Generated Changes 补齐原生 git 栈操作(--update-refs、rebase --onto、--force-with-lease)和 Graphite CLI 核心命令
    • 以上内容均为中英双语成对维护

    为什么发这个版本

    v2.0 确立了面向 AI 编程时代的方向,但 agent 治理和协作约定还是空白。

    AI agent 已经在创建分支、发起 PR、触发 CI,v2.1.0 把它们从"diff 生成器"升级为"被治理的参与者":管理者有了治理配置清单,团队有了可复制的 AGENTS.md 模板,开发者有了多 Agent 并行和栈式 PR 的实操命令。

  3. v2.0.1v2.0.1: Open Source Governance and Maintenance Updates2026-06-07 · 2026-06-07 02:13 UTC
    查看更新说明

    v2.0.1: Open Source Governance and Maintenance Updates

    This maintenance release strengthens the project as a public open source handbook.

    Highlights

    Why This Release

    v2.0.0 established the handbook direction around modern Git/GitHub collaboration and AI-native development workflows.

    v2.0.1 makes the project easier to review, contribute to, and maintain as an open source project.

    Validation

    • python3 scripts/check-docs.py
    • git diff --check
  4. v2.0.0v2.0.0: Modern Git & AI-Native Engineering Handbook2026-06-03 · 2026-06-03 02:57 UTC
    查看更新说明

    Highlights

    • 更新仓库定位,面向现代工程团队与 AI 编程时代的 Git / GitHub 实战场景
    • 新增 AI Native Git Workflow、AI 代码 Review、AI 变更审查实战样例
    • 新增团队 Git 工作流指南,覆盖 GitHub Flow、GitLab Flow、Gitflow、Trunk-Based Development、Release Branch 等选型
    • 新增 GitHub 工程治理内容,覆盖分支保护、Rulesets、CODEOWNERS、Merge Queue、Actions、Release、安全扫描
    • 新增 Git 高频事故处理手册,覆盖误提交、reset、rebase、force push、secret 入库等常见问题
    • 新增大仓库实践内容,覆盖 partial clone、sparse checkout、Git LFS、worktree、repo maintenance
    • 新增可复制模板,包括 PR、Issue、Code Review、AI Review、commit message、release note、hotfix、branch naming
    • 新增大厂工程实践案例目录,用公开资料整理 Google、Microsoft、Meta、Uber、Netflix、Shopify、Slack 等工程经验

    Why v2.0

    v2.0 聚焦三个变化:

    1. Git 的使用场景从个人命令学习,扩展到团队协作、Review、发布、恢复和工程治理
    2. AI 编程让代码生成更快,也让 diff 审查、commit 拆分、验证和回滚更重要
    3. 中文工程团队需要更多能直接落地的 Git / GitHub 协作模板和判断路径

    Recommended Reading

    Notes

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    My Git Handbook

    English | 中文

    面向 AI Native 软件工程的 Git 变更控制手册:理解原理,验证改动,管理协作。

    AI 会操作,人为什么还要学?

    AI 可以代劳命令,理解决定我们能看见哪些选择、提出什么问题,以及凭什么接受结果。脑中没有一个概念,遇到问题时就很难想到用它。

    我维护这个仓库,是希望把 Git 中值得传承的设计讲清楚:快照如何记录状态,对象如何复用内容,引用如何组织历史,以及协作如何处理分歧。让这些思想成为人的判断依据,让 AI 帮助我们实验、执行和验证。

    学习的重心,从熟练执行,走向理解、判断与验证。 操作仍然值得练习,尤其是读懂关键命令和识别风险;实践是检验理解的方式。

    读完整理念 · 直接打开交互学习

    从理解设计到管理协作

    先用知识地图确认自己正在解决的是原理、一次工程变更还是团队协作,再进入下面的文章。

    你想获得什么从这里开始学会后能判断什么
    理解设计交互学习 → 完整学习路径改动存在哪里,历史如何形成,恢复依赖什么
    完成工程变更一次变更的完整验收 → AI 变更审查样例范围、提交版本和测试证据是否对应
    管理协作团队 Git 工作流指南 → GitHub 工程治理如何隔离、审查、授权、发布与恢复

    Git 提供版本与历史的基础。测试、审查、权限、制品和发布系统一起,才能形成完整的变更控制。这里既讲工具的能力,也讲它的边界。

    适合谁

    • Git 新手,希望建立正确心智模型
    • 普通开发者,经常需要处理冲突、回滚、误提交
    • 高级开发者,关心 PR、Review、CI、发布协作
    • 技术负责人,需要设计团队 Git 工作流和 GitHub 治理规范
    • AI 编程用户,需要控制 Codex、Claude Code、Cursor、Cline 等工具带来的代码变更风险

    目录导航

    目录主要内容
    01-getting-startedGit 入门、心智模型,以及知识地图
    02-daily-workflow日常命令、分支合并、rebase、stash、worktree
    03-team-collaboration团队工作流、PR、Code Review、协作模型选型
    04-github-engineering分支保护、Rulesets、CODEOWNERS、CI、发布、安全
    05-ai-native-developmentAI 编程下的 diff 审查、commit 拆分、worktree、多 Agent
    06-troubleshootingGit 误操作恢复、冲突处理、secret 清理、force push 恢复
    07-large-repo大仓库、monorepo、partial clone、sparse checkout、Git LFS
    08-templatesPR、Issue、Review、Hotfix、Release、AI Review 模板
    10-company-practices大厂工程实践案例和决策图谱

    在线交互学习

    通过动画、文章和临时仓库实验理解 Git 的快照、对象图、引用、历史变化、远端、worktree 与存储。十个主题按同一顺序安排,01 至 03 对应既有交互,04 至 10 对应新增交互;材料与脚本可检查,读者理解仍需要用预测、重现和迁移来验证。

    打开 Git 心智模型交互实验

    查看十个主题的文章、交互与实验导航

    学习路径

    新手路径

    1. 为什么在 AI 时代学习 Git
    2. Git 心智模型
    3. 十个主题的课程导航:每个主题都连接文章、交互和临时仓库实验。
    4. Git 基础命令
    5. 日常 Git 命令

    日常开发路径

    1. 分支与合并
    2. Rebase 与 Merge
    3. Stash
    4. Worktree

    团队协作路径

    1. 团队 Git 工作流指南
    2. GitLab Flow
    3. Pull Request 最佳实践
    4. Code Review 最佳实践
    5. GitHub Flow
    6. Trunk-Based Development
    7. Gitflow

    GitHub 工程治理路径

    1. GitHub 工程治理手册
    2. 企业 GitHub 协作配置栈
    3. 分支保护
    4. Rulesets
    5. Merge Queue
    6. GitOps and Config as Code
    7. 发布管理
    8. AI Agent 治理

    AI Native 开发路径

    1. 一次工程变更课程
    2. 接受 Agent 变更
    3. AI 生成变更的 CI
    4. 后台 Agent 任务
    5. AI Native Git Workflow
    6. AI 生成代码 Review
    7. Codex / Claude Code Git 实践
    8. AI 编程工具的 Git 集成实践
    9. Worktree for AI Agents
    10. Stacked PR for AI-Generated Changes
    11. AI Reviewer 与 Human Reviewer
    12. AI 协作度量

    故障处理路径

    1. Git 高频事故处理手册
    2. Agent 事故恢复
    3. Undo Anything
    4. Recover Lost Commit
    5. Remove Secret from History

    按问题找答案

    我现在遇到的问题建议先看
    刚把 commit 提交到了错误分支Committed to Wrong Branch
    reset、rebase、force push 后不知道怎么恢复Git 高频事故处理手册
    团队不知道该选 GitHub Flow、Gitflow 还是 Trunk-Based Development团队 Git 工作流指南
    PR 太大,Review 很慢Pull Request 最佳实践
    AI 一次改了很多文件,不知道怎么审AI 变更审查实战样例
    AI 生成的大 diff 需要拆 commit 或拆 PRAI Commit Splitting、Stacked PR for AI-Generated Changes
    想保护 main 分支Branch Protection
    AI agent 开始直接提交代码、发 PR,不知道怎么管AI Agent 治理
    想给团队仓库写一份 agent 协作约定AGENTS.md 模板
    PR 很多,主分支经常被合坏Merge Queue
    大仓库 clone、status、checkout 很慢Large Repository Git Practices
    想直接复制团队模板Templates

    第一阶段最值得读

    推荐资料来源

    新内容会优先参考官方文档和业界常用资料:

    更完整的资料索引见 推荐阅读。

    版本与维护计划

    详细计划见 roadmap。

    课程、修复和协作材料已整理为 v2.2.0 发布说明与 Changelog。发布文档准备日期为 2026-09-09;版本状态见 GitHub Releases。

    已有内容会逐步纳入新的学习路径,迁移清单见 legacy content migration,资料索引见 resources。

    项目治理

    本仓库原创内容采用 MIT License。第三方资料、历史电子书、外部文章、链接资源和引用内容仍遵循其原始许可证和版权声明。

    Contributing

    欢迎贡献真实问题、团队实践、事故恢复经验、AI 编程工作流和可复用模板。

    新内容请遵循 Content Style Guide。