企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 一、概述 Pull Request 是一种通知机制。你修改了他人的代码,将你的修改通知原来的作者,希望他合并你的修改,这就是 Pull Request; ## 二、流程 ### **fork主仓库到自己的github** fork目标工程在GitHub上的Repository到自己账户的github上,完成后,自己的github上将会出现一个fork的Repository; ![](https://img.kancloud.cn/73/36/733652309e56ddf27d80c14060d6705b_1920x1039.png) ![](https://img.kancloud.cn/0a/6c/0a6cde29d22d99e07a396da7088a421e_1920x942.png) fork完成后,可以看到,自己的github上,多了一个fork目标工程的Repository了: ![](https://img.kancloud.cn/13/c8/13c87388fbf98c3cbe646cbb2464c387_1920x1039.png) ### **clone自己的github上fork来的Repository到本地修改** ![](https://img.kancloud.cn/48/06/4806684469b84b449630cb48e9740367_1239x647.png) 本地: ![](https://img.kancloud.cn/65/1a/651a5914d50d13340149312738dae83a_1920x616.png) 假设,我修改了README.md文件,新增了一个addForTestPr.md文件; ![](https://img.kancloud.cn/c7/81/c78153b07b1259062c457c12d3fb395a_1920x549.png) 提交代码到自己的github上fork来的Repository库 ![](https://img.kancloud.cn/ea/42/ea42e264875a828ed01608dc573b5590_1490x785.png) 查看自己的fork仓库: ![](https://img.kancloud.cn/50/f5/50f5ee3bdb044e0abf02c38779d0eef0_1920x1039.png) ### **在自己的github上fork来的Repository中发起PullRequest** ![](https://img.kancloud.cn/0f/4a/0f4aec08e5f367b7cd8c0f2eaedbba05_1920x1039.png) ![](https://img.kancloud.cn/c0/2e/c02ec27ffa4bd603ebb62f8cf5563b57_1920x1039.png) ![](https://img.kancloud.cn/e2/99/e29986b568c3402cbd99e702677aaca0_1920x1039.png) 提交后,就待主工程管理者合并了: ![](https://img.kancloud.cn/58/81/588163742d7706baed46ffbd6fdadd3e_1920x1039.png) ### **主工程管理者接收或者拒绝合并** 在主工程的PullRequest标签中,将会出现待合并的PR; ![](https://img.kancloud.cn/61/04/61049a592ee9d87f4aa3cb3cc83f2fbb_1920x945.png) 进入PR详情; ![](https://img.kancloud.cn/53/c8/53c8823072c1cc67f550b42b41ef9c16_1920x948.png) 如果有冲突,则进入冲突明细界面,来处理冲突; ![](https://img.kancloud.cn/00/4e/004eb2314fa97df9eaf1d4afc39e12d5_1911x924.png) ![](https://img.kancloud.cn/30/5c/305cbfc0147dd686f43fe1a6c84150d1_1920x864.png) 冲突处理完毕,回到详情页,继续处理合并; ![](https://img.kancloud.cn/a7/5a/a75ae7569501a54004428c0113658dc9_1920x1048.png) 同意合并,合并完成; ![](https://img.kancloud.cn/0d/57/0d57c15ea4feac1d57ca77511af9524a_1920x871.png) 如果拒绝,则该PR就无效; ## 三、Fork来的库如何同步源库 fork过来的工程,主页如: ![](https://img.kancloud.cn/f5/0d/f50d1ca07827aba58e10f88c4942ca53_1920x942.png) 1、如果原库有新的commit,则fork库主界面上,就有提示; ![](https://img.kancloud.cn/76/de/76dec6142b0938aee32d52587337c7ea_1920x942.png) ![](https://img.kancloud.cn/73/f6/73f6ef29705261d9d6b19f0617f6141d_1920x942.png) 2、执行Fetch and merge按钮操作即可完成源库到fork库的更新了; 执行完后,就与源库同步了; ![](https://img.kancloud.cn/10/07/10074300db2038ed2ed03bf0b4d69ab8_1920x942.png)