蒋鑫:从Git社区看配置管理.pdf

上传人:来看看 文档编号:3335268 上传时间:2019-08-13 格式:PDF 页数:52 大小:6.97MB
返回 下载 相关 举报
蒋鑫:从Git社区看配置管理.pdf_第1页
第1页 / 共52页
蒋鑫:从Git社区看配置管理.pdf_第2页
第2页 / 共52页
蒋鑫:从Git社区看配置管理.pdf_第3页
第3页 / 共52页
蒋鑫:从Git社区看配置管理.pdf_第4页
第4页 / 共52页
蒋鑫:从Git社区看配置管理.pdf_第5页
第5页 / 共52页
点击查看更多>>
资源描述

《蒋鑫:从Git社区看配置管理.pdf》由会员分享,可在线阅读,更多相关《蒋鑫:从Git社区看配置管理.pdf(52页珍藏版)》请在三一文库上搜索。

1、从Git社区看Git 群英汇蒋鑫 2012/7/19 从我用商业软件制作PPT 开始说起. 2 Git 像微博? 3 传统网络媒体 / SVN微博 / Git 小而固定的编辑群体人人都是微媒体 集中式的发布流程基于信任(加粉)的发布和传播 封站、单点故障“禁言”不影响转发 读者参与欲望低生活的一部分、full of fun 新一代分布式版本控制系统 4 服务器 DVCS 终端 终端 终端 share repo “普通青年”如何使用Git ooo oooooo cloneclone oooooo “普通青年”如何使用Git ooo ooo share repo commit commit ooo

2、 oo oooo “普通青年”如何使用Git ooo ooo share repo ooo X 修补提交 ? 压缩提交 oo oooo “普通青年”如何使用Git ooo ooo share repo ooo ooo ooo “普通青年”如何使用Git ooo ooo ooo ooooo share repo push(Fast-Forward PUSH) “普通青年”如何使用Git ooo ooo ooo ooo ooooo 非快进式(Non-Fast-Forward) push share repo “普通青年”如何使用Git ooo ooo ooo ooo ooo fetch share

3、 repo ooooo “普通青年”如何使用Git ooo ooo ooo ooo ooooo ooo share repo merge ooo ooo oo o “普通青年”如何使用Git ooo ooo ooooo o ooo share repo push DAG ooooo o ooo ooo ooo “普通青年”如何使用Git ooooo o ooo ooooo o ooo share repo pull “普通青年”如何使用Git 15 clonecommitcommit push fast- forward? pull conflict? mergetool push 是 是 否

4、 否 add add rm mv 使用Git,项目规模可以提高 一个数量级! 16 SVN的小而固定的“编辑群” 寻找一个使用SVN的开源项目并不容易了 ;-) Apache Subversion(根据提交说明统计) 1 3902 Karl Fogel 2 3728 Hyrum Kurt Wright 3 3440 C. Michael Pilato 4 2422 Julian Foad 5 2354 Bert Huiben . 176 1 Arwin Arni 17 管理负担导致“小而固定编辑群” 提交者越多版本库管理越复杂 统一认证和授权管理 贡献者苦恼 无法版本控制 贡献间接署名 18

5、Git 的署名作者有多少? 针对 Git v1.7.11 的统计 $ git log -pretty=“%an“ v1.7.11 | sort | uniq -c | sort -rn | less -N 1 10904 Junio C Hamano 2 1328 Shawn O. Pearce 3 1103 Linus Torvalds 4 855 Jeff King 5 729 Johannes Schindelin . 1028 1 Aaron Crane 19 Git中贡献皆署名 $ git log -1 -pretty=fuller v1.7.1134 commit f50b565a

6、0f3af5a4045d0e713ac43e3f0de3aa9a Author: Jiang Xin AuthorDate: Thu May 31 19:20:42 2012 +0800 Commit: Junio C Hamano CommitDate: Fri Jun 1 07:43:10 2012 -0700 i18n: apply: split to fix a partial i18n message The 4th arg of “new mode (%o) of %s does not match old mode (%o)%s%s“ is blank string or str

7、ing “ of “. Even mark the string “ of “ for a complete i18n, this message is still hard to translate right. Split it into two slight different messages would make l10n teams happy. Signed-off-by: Jiang Xin Signed-off-by: Junio C Hamano 20 “文青”使用Git 人人皆可Hack 克隆或更新 未克隆? $ git clone git:/git.kernel.org

8、/pub/scm/git/git.git $ cd git 已克隆? $ cd git $ git pull 创建本地分支 myhack $ git checkout -b myhack master Hack. 提交(带 s-o-b 签名) $ git commit -s 21 只读 “文青”使用Git 查看 myhack 分支提交:git show -stat -pretty=fuller HEAD commit e0a47e9dfee5278bad948c91f7707ac766d99d7d Author: Jiang Xin AuthorDate: Thu May 31 19:20:4

9、2 2012 +0800 Commit: Jiang Xin CommitDate: Thu May 31 19:29:28 2012 +0800 i18n: apply: split to fix a partial i18n message The 4th arg of “new mode (%o) of %s does not match old mode (%o)%s%s“ is blank string or string “ of “. Even mark the string “ of “ for a complete i18n, this message is still ha

10、rd to translate right. Split it into two slight different messages would make l10n teams happy. Signed-off-by: Jiang Xin builtin/apply.c | 16 +- 1 个文件被修改,插入 12 行(+),删除 4 行(-) 22 时间戳不同? git commit -amend “文青”使用Git 创建补丁 $ LANGUAGE=C git format-patch -no-thread -no-cover-letter HEADHEAD 0001-i18n-apply

11、-split-to-fix-a-partial-i18n-message.patch 查看补丁 $ head -6 0001-i18n-apply-split-*.patch From e0a47e9dfee5278bad948c91f7707ac766d99d7d Mon Sep 17 00:00:00 2001 From: Jiang Xin Date: Thu, 31 May 2012 19:20:42 +0800 Subject: PATCH i18n: apply: split to fix a partial i18n message The 4th arg of “new mod

12、e (%o) of %s does not match old mode (%o)%s%s“ 23 “文青”使用Git 通过邮件发送补丁 $ git send-email -to “Junio C Hamano “ -cc “Git List “ -cc “var Arnfjr Bjarmason “ -cc “Nguyn Thi Ngc Duy “ -cc “Jonathan Nieder “ 0001-i18n-apply-split-to-fix-a-partial-i18n-message.patch 邮件相关设置 $ git config -l | grep sendemail se

13、ndemail.chainreplyto=true sendemail.smtpencryption=ssl sendemail.smtpserver= sendemail.smtpuser= 24 “文青”使用Git 通过邮件列表评审 25 “文青”使用Git Junio应用贡献者的补丁: git am -s file. 官方库中的提交: git log -1-pretty=fuller HEAD commit f50b565a0f3af5a4045d0e713ac43e3f0de3aa9a Author: Jiang Xin AuthorDate: Thu May 31 19:20:42

14、2012 +0800 Commit: Junio C Hamano CommitDate: Fri Jun 1 07:43:10 2012 -0700 i18n: apply: split to fix a partial i18n message The 4th arg of “new mode (%o) of %s does not match old mode (%o)%s%s“ is blank string or string “ of “. Even mark the string “ of “ for a complete i18n, this message is still

15、hard to translate right. Split it into two slight different messages would make l10n teams happy. Signed-off-by: Jiang Xin Signed-off-by: Junio C Hamano 1 http:/git-blame.blogspot.jp/p/note-from-maintainer.html 梯子自备 其他参考 1 integration managers 子项目的合并 32 Git合并的子项目 gitk git-gui gitweb(不再独立更新) git-subt

16、ree(不再独立更新) 项目目录结构重叠,要作为子树合并 git subtree add -P subdir alien-branch git merge -Xsubtree=subdir alien-branch 逐级的Pull request 和 pull 33 clone commitcommit push -u XX master fetch XX push remote add XX URL request-pull merge -ff-only XX/master conflict? merge -abort fetch origin merge rebase remote add

17、 XX URL 是 否 Pull requests 34 Git本地化工作流 35 工作流原则 没人了解所有自然语言:每个语种一个负责人 有人要分担Junio工作:一个“l10n协调者” 本地化贡献者无需精通Git: 不需要补丁模式 无需自建Git服务器 无需命令行操作创建给“l10n协调者”的Pull Request GitHub GitHub简化了如下的流程 36 clone commitcommit push -u XX master fetch XX push remote add XX URL request-pull merge -no-ff XX/master conflict?

18、 merge -abort fetch origin merge rebase remote add XX URL 是 否 fork pull request merge git-l10n/git-po 37 本地化中的Git操作 38 zh_CN l10n team: commit vi po/zh_CN.po $ git commit -s $ git push zh_CN l10n team: GitHub Pull Request l10n coordinator: Pull $ git clone ssh:/ $ cd git-po $ git remote add zh-CN gi

19、t:/ $ git fetch zh-CN $ git merge zh-CN/master l10n coordinator: check, push & pull request $ po-helper.sh check $ git push $ git request-pull . GitHub Pull Request 39 不能改动 po/ 目录之外的文件 XX.po 文件的语法检查 提交说明格式:遵循50/72原则、s-o-b 提交说明字符集:可用UTF-8,但第一行要全英文 占位式提交用分支暂存:WIP/XX/master 辅助工具:po-helper.sh https:/ L1

20、0n协调者对Pull Request的审核 40 创建给Junio的Pull Request 41 命令 $ git request-pull junio/master git:/ master 输出 Pull Request 文本 The following changes since commit 726016725d45894c061e8d187385327f82803c9f: Sync with i18n-po updates in maint (2012-07-02 15:37:54 -0700) are available in the git repository at: git

21、:/ for you to fetch changes up to 6792b93b1965561e85be3733bb3ab00b2e598119: l10n: zh_CN.po: translate 29 new messages (2012-07-06 09:11:15 +0800) . Pull Request发送至Git列表 42 Git工作流汇总 43 集中式(Beginner & Business) 未见有开源社区使用此模式 补丁式:format-patch, mailing list & am 绝大多数 Git 贡献者 通过邮件列表,全员参与的代码审核 子树合并 git-gui

22、, gitk, . 逐级的Pull request & pull 例如 Junio 和 integration managers 之间 GitHub Pull Request L10n coordinator 和 l10n team leaders 之间 Linus 不喜欢 GitHub Pull Request https:/ Git分支管理四个整合分支 git.git 的四个整合分支 maint : 当前最新发布版本/维护版本 最新提交一定对应一个Tag:v1.7.11, v1.7.11.1, v1.7.11.2 master : 下一个发布版本 git describe 结果: v1.7

23、.11.2-194-g7bdb7 v1.7.12-rc0 next : 主题分支并入master分之前的测试 pu : proposed updates 参考 $ git help workflows 44 Git分支管理Merge的学问 基于最老的支持版本做Bugfix 合并方向: maint-1.6.x maint master 维护版本发布 git tag -s v1.7.11.2 maint git log mastermaint git checkout master git merge maint git push git push -tags 新版本发布 git tag -s v

24、1.7.12 master git checkout maint git merge -ff-only master git push git push -tags 45 快进式合并 46 myhack git merge -ff other other myhack myhack 非快进式合并 47 137 git merge -no-ff other other myhack myhack myhack 仅快进式合并 48 137 other git merge -ff-only other 关于SVN和Git的一些思考 SVN工作区有一个或多个 .svn 目录,作用? Git的 .git

25、 目录呢? SVN和Git的工作区,谁的磁盘空间占用大? Git提交是Delta还是全量提交? SVN本地工作区测试通过,提交后CI服务器测试 是否一定通过? 一个SVN版本库最多支持多少提交账号? SVN和Git合并追踪有何不同? 49 企业应用Git的担心? 脱库: 谁不能? 路径授权 拆分版本库授权比 SVN 授权更安全 操作复杂? 亦可集中式 且可实现强制审核 没有大公司在用? Google 50 企业应用Git的好处 不存在混合提交,有 git bisect 更好的分支管理 分布式工作流,代码评审 对跨地域团队提供天然支持 安全,管理成本低 快 51 参考 Keynote下载: git clone git:/ https:/ 我的书 http:/ http:/ 微博和微群 http:/ http:/ 52

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/环境 > 装饰装潢


经营许可证编号:宁ICP备18001539号-1