Submit Search
Upload
Git 实战
•
Download as PPTX, PDF
•
1 like
•
1,187 views
E
Edward Lee
Follow
从项目实际开发流程角度介绍Git命令,结合成功的分支模型和GUI工具。
Read less
Read more
Technology
Design
Report
Share
Report
Share
1 of 30
Download now
Recommended
git, repo, Gerrit 基礎教學
git, repo, Gerrit 基礎教學
Doremi Lin
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹
PingLun Liao
寫給大家的 Git 教學
寫給大家的 Git 教學
littlebtc
版本控制 使用Git & git hub
版本控制 使用Git & git hub
維佋 唐
Xcode 的 git 版本管理
Xcode 的 git 版本管理
彼得潘 Pan
Git 入门实战
Git 入门实战
icy leaf
Git内部培训文档
Git内部培训文档
superwen
Git基礎介紹
Git基礎介紹
Max Ma
Recommended
git, repo, Gerrit 基礎教學
git, repo, Gerrit 基礎教學
Doremi Lin
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹
PingLun Liao
寫給大家的 Git 教學
寫給大家的 Git 教學
littlebtc
版本控制 使用Git & git hub
版本控制 使用Git & git hub
維佋 唐
Xcode 的 git 版本管理
Xcode 的 git 版本管理
彼得潘 Pan
Git 入门实战
Git 入门实战
icy leaf
Git内部培训文档
Git内部培训文档
superwen
Git基礎介紹
Git基礎介紹
Max Ma
Git與source tree 基礎教學
Git與source tree 基礎教學
Duncan Chen
Introduction to git
Introduction to git
Bo-Yi Wu
A successful git branching model 導讀
A successful git branching model 導讀
Wen Liao
Git原理与实战 201607
Git原理与实战 201607
Charles Tang
Git share
Git share
mactanxin
Git and git hub
Git and git hub
唯 李
簡介 GitHub 平台
簡介 GitHub 平台
Will Huang
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用
Will Huang
工程師必備第一工具 - Git
工程師必備第一工具 - Git
Alan Tsai
Git & git hub v1.2
Git & git hub v1.2
Chris Chen
First meetingwithgit
First meetingwithgit
Rhythm Sun
Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)
Cloud Tu
Git 入門與實作
Git 入門與實作
奕浦 郭
連哈秋都懂的Git教學
連哈秋都懂的Git教學
hydai
Git 版本控制 (使用教學)
Git 版本控制 (使用教學)
Jui An Huang (黃瑞安)
Android 程式設計(4)
Android 程式設計(4)
Roy Wang
Mecurial hg
Mecurial hg
iaiyang
Git
Git
Min Micro
Ian 20150515 grunt
Ian 20150515 grunt
LearningTech
Git & git flow
Git & git flow
Amo Wu
高性能的Java代码编写及常见问题排查
高性能的Java代码编写及常见问题排查
bluedavy lin
Java常见问题排查
Java常见问题排查
bluedavy lin
More Related Content
What's hot
Git與source tree 基礎教學
Git與source tree 基礎教學
Duncan Chen
Introduction to git
Introduction to git
Bo-Yi Wu
A successful git branching model 導讀
A successful git branching model 導讀
Wen Liao
Git原理与实战 201607
Git原理与实战 201607
Charles Tang
Git share
Git share
mactanxin
Git and git hub
Git and git hub
唯 李
簡介 GitHub 平台
簡介 GitHub 平台
Will Huang
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用
Will Huang
工程師必備第一工具 - Git
工程師必備第一工具 - Git
Alan Tsai
Git & git hub v1.2
Git & git hub v1.2
Chris Chen
First meetingwithgit
First meetingwithgit
Rhythm Sun
Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)
Cloud Tu
Git 入門與實作
Git 入門與實作
奕浦 郭
連哈秋都懂的Git教學
連哈秋都懂的Git教學
hydai
Git 版本控制 (使用教學)
Git 版本控制 (使用教學)
Jui An Huang (黃瑞安)
Android 程式設計(4)
Android 程式設計(4)
Roy Wang
Mecurial hg
Mecurial hg
iaiyang
Git
Git
Min Micro
Ian 20150515 grunt
Ian 20150515 grunt
LearningTech
Git & git flow
Git & git flow
Amo Wu
What's hot
(20)
Git與source tree 基礎教學
Git與source tree 基礎教學
Introduction to git
Introduction to git
A successful git branching model 導讀
A successful git branching model 導讀
Git原理与实战 201607
Git原理与实战 201607
Git share
Git share
Git and git hub
Git and git hub
簡介 GitHub 平台
簡介 GitHub 平台
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用
工程師必備第一工具 - Git
工程師必備第一工具 - Git
Git & git hub v1.2
Git & git hub v1.2
First meetingwithgit
First meetingwithgit
Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)
Git 入門與實作
Git 入門與實作
連哈秋都懂的Git教學
連哈秋都懂的Git教學
Git 版本控制 (使用教學)
Git 版本控制 (使用教學)
Android 程式設計(4)
Android 程式設計(4)
Mecurial hg
Mecurial hg
Git
Git
Ian 20150515 grunt
Ian 20150515 grunt
Git & git flow
Git & git flow
Viewers also liked
高性能的Java代码编写及常见问题排查
高性能的Java代码编写及常见问题排查
bluedavy lin
Java常见问题排查
Java常见问题排查
bluedavy lin
线上问题排查交流
线上问题排查交流
Edward Lee
Taobao图片存储与cdn系统到服务
Taobao图片存储与cdn系统到服务
Wensong Zhang
Erlang及其应用
Erlang及其应用
Feng Yu
Erlang高级原理和应用
Erlang高级原理和应用
Feng Yu
Inside Erlang Vm II
Inside Erlang Vm II
Feng Yu
Linux内存管理
Linux内存管理
zijia
Linux内存管理
Linux内存管理
zijia
LVS development and experience
LVS development and experience
Wensong Zhang
Java memory problem cases solutions
Java memory problem cases solutions
bluedavy lin
DAE
DAE
Qiangning Hong
账务系统设计及应用
账务系统设计及应用
wang zaixiang
VMIL keynote : Lessons from a production JVM runtime developer
VMIL keynote : Lessons from a production JVM runtime developer
Mark Stoodley
Python在豆瓣的应用
Python在豆瓣的应用
Qiangning Hong
C1000K高性能服务器构建技术
C1000K高性能服务器构建技术
Feng Yu
Erlang分布式系统的的领域语言
Erlang分布式系统的的领域语言
Feng Yu
Redis原生命令介绍
Redis原生命令介绍
Edward Lee
Implementing a JavaScript Engine
Implementing a JavaScript Engine
Kris Mok
分布式Key Value Store漫谈
分布式Key Value Store漫谈
Tim Y
Viewers also liked
(20)
高性能的Java代码编写及常见问题排查
高性能的Java代码编写及常见问题排查
Java常见问题排查
Java常见问题排查
线上问题排查交流
线上问题排查交流
Taobao图片存储与cdn系统到服务
Taobao图片存储与cdn系统到服务
Erlang及其应用
Erlang及其应用
Erlang高级原理和应用
Erlang高级原理和应用
Inside Erlang Vm II
Inside Erlang Vm II
Linux内存管理
Linux内存管理
Linux内存管理
Linux内存管理
LVS development and experience
LVS development and experience
Java memory problem cases solutions
Java memory problem cases solutions
DAE
DAE
账务系统设计及应用
账务系统设计及应用
VMIL keynote : Lessons from a production JVM runtime developer
VMIL keynote : Lessons from a production JVM runtime developer
Python在豆瓣的应用
Python在豆瓣的应用
C1000K高性能服务器构建技术
C1000K高性能服务器构建技术
Erlang分布式系统的的领域语言
Erlang分布式系统的的领域语言
Redis原生命令介绍
Redis原生命令介绍
Implementing a JavaScript Engine
Implementing a JavaScript Engine
分布式Key Value Store漫谈
分布式Key Value Store漫谈
Similar to Git 实战
Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)
flylon
Git Essence Tutorial
Git Essence Tutorial
Ho Kim
Git使用入门
Git使用入门
dpf2e
Git in a nutshell
Git in a nutshell
Nelson Tai
Git 使用介绍
Git 使用介绍
medcl
COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報
Bachue Zhou
Git+使用教程
Git+使用教程
gemron
Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀
Wen-Tien Chang
Git 教學
Git 教學
Ming-Sian Lin
Git Tutorial
Git Tutorial
Drake Huang
容器與 Gitlab CI 應用
容器與 Gitlab CI 應用
Philip Zheng
20150313 ian git
20150313 ian git
LearningTech
Learn git
Learn git
甘 李
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuan
Wei-Yuan Chang
Github in xcode
Github in xcode
郁凱 曾
Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)
Hsin-lin Cheng
Git introduction
Git introduction
mythnc
Git Tutorial 教學
Git Tutorial 教學
Wen-Tien Chang
用Bluemix DevOps 建立良好的團隊開發與版本控制
用Bluemix DevOps 建立良好的團隊開發與版本控制
Hsuan-Ju Lin
Submodule && subtree
Submodule && subtree
哲 于
Similar to Git 实战
(20)
Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)
Git Essence Tutorial
Git Essence Tutorial
Git使用入门
Git使用入门
Git in a nutshell
Git in a nutshell
Git 使用介绍
Git 使用介绍
COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報
Git+使用教程
Git+使用教程
Git 版本控制系統 -- 從微觀到宏觀
Git 版本控制系統 -- 從微觀到宏觀
Git 教學
Git 教學
Git Tutorial
Git Tutorial
容器與 Gitlab CI 應用
容器與 Gitlab CI 應用
20150313 ian git
20150313 ian git
Learn git
Learn git
Learning to Use Git | WeiYuan
Learning to Use Git | WeiYuan
Github in xcode
Github in xcode
Git 簡介(古時候的簡報備份)
Git 簡介(古時候的簡報備份)
Git introduction
Git introduction
Git Tutorial 教學
Git Tutorial 教學
用Bluemix DevOps 建立良好的團隊開發與版本控制
用Bluemix DevOps 建立良好的團隊開發與版本控制
Submodule && subtree
Submodule && subtree
Git 实战
1.
Git 实战 项目开发流程 李华刚 -
平台研发部 @jr子木
2.
Agenda • 远程仓库克隆 • 本地仓库配置 •
分支管理 • 功能开发 • GUI工具 • 合并发布 |2
3.
git-help – 打开命令的本地HTML手册页 模式 git
help [-w] [COMMAND] 示例 1. git help help 2. git help -w clone ―浏览器‖方式打开 1. git config --global help.format html 2. git config --global web.browser firefox |3
4.
git-clone – 克隆一个仓库到一个新的目录 模式 git
clone <repository> [<directory>] 示例 1. git clone http://git.intra.weibo.com/huagang1/git_demo.git git_demo # 克隆远程仓库到本地 2. cd git_demo 3. ls –a .git :Git目录($GIT_DIR) |4
5.
git-config – 配置开发者用户名和邮箱地址 模式 git
config [--global] name [value] git config --get name 示例 1. git config user.name xxx 2. git config user.email xxx@xxx 配置文件 1. .git/config:仓库层面 2. ~/.gitconfig:用户层面(--global) |5
6.
gitignore – 指定不想追踪的文件 模式 .gitignore .git/info/exclude 示例 1.
edit/copy .gitignore 最佳实践 提交 .gitignore 文件到远程中央仓库。 |6
7.
git-status – 显示工作目录的状态 模式 git
status [<options>…] 示例 1. git status [InfoQ专栏] Git历险记(四)—— 索引与提交的幕后故事 |7
8.
git-add – 添加文件内容到索引 模式 git
add [<filepattern>…] 示例 1. git add .gitignore 2. git ls-files --stage # 查看暂存区内容 3. git cat-file -p [Content-SHA1] # 查看文件内容 相关知识 索引,也称暂存区(staging area),存放下一次提交的内容。(.git/index) |8
9.
git-commit - 记录变更到本地仓库 模式 git
commit [-a] [-m <msg>] [<file>…] 示例 1. git commit -m ―add .gitignore file‖ # 提交已暂存的文件 提交描述编码(.git/etc/gitconfig) [i18n] commitencoding = UTF-8 logoutputencoding = UTF-8 |9
10.
git-branch – 查看、创建分支 模式 git
branch [-r | -a] [<pattern>…] git branch <branchname> 示例 1. git branch # 查看本地仓库的所有分支(.git/refs/heads) 2. git branch demo # 创建“demo”分支 3. ls .git/refs/heads # 一个分支名对应一个文件 4. less .git/refs/heads/demo # 查看“demo”分支内容 [InfoQ专栏] Git历险记(五)—— Git里的分支&合并 | 10
11.
git-checkout – 切换工作目录到另一个分支 模式 git
checkout [<branch>] 示例 1. git checkout demo # 切换到“demo”分支工作 2. Make demo dir, then add 1.txt 2.txt 3.txt # 伪代码 3. git status | 11
12.
git-gui – Git图形化界面 示例 git
gui | 12
13.
git-reset – 重置当前HEAD到指定的状态 模式 git
reset [<commit>] <paths>… git reset (--soft | --mixed | --hard) [<commit>] 示例 1. git add demo/2.txt demo/3.txt # 添加到索引 2. git status 3. git reset HEAD demo/2.txt # 撤销2.txt的变更 4. git commit -am "add 'demo/3.txt' file" 5. git reset --soft HEAD^ # 回滚最近一次提交的所有内容,但保留本地变更内容 6. git reset --hard HEAD^ # 彻底回滚最近一次提交 [警告] 慎用git-checkout命令,其会把所有本地变更都覆盖掉! | 13
14.
gitk – Git本地仓库浏览器 示例 gitk |
14
15.
[练手] 改动分支内容并提交 示例 1. git add
demo/2.txt 2. modify 3.txt file 3. git status 4. git commit -m "add 'demo/2.txt' file" #只提交暂存区里的内容 5. git status 6. git commit -am "add 3 to 'demo/2.txt' file" # 提交已暂存的3.txt文件内容,但注释有 误! 7. git reset --soft HEAD^ # 回滚最近一次提交,同时保留本地所有改动的内容 8. git status 9. git commit -a -m "add 3 to 'demo/3.txt' file" | 15
16.
gitk – 可视化冲突比较 示例 1. Commit
‗conflict.txt‘ to ‗demo‘ branch # 伪代码 2. Commit 'conflict.txt' to 'master' branch 3. gitk master...demo # 3个点 | 16
17.
gitk – 可视化冲突比较 |
17
18.
git-merge – 加入多个开发历史到当前分支 模式 git
merge <commit>… 示例 1. git status 2. git checkout master # 切换到“master‖分支工作 3. git merge demo # 合并―demo‖分支到当前分支 Auto-merging demo/conflict.txt CONFLICT (add/add): Merge conflict in demo/conflict.txt # 存在冲突 Automatic merge failed; fix conflicts and then commit the result. # 解决冲突后,再提交 | 18
19.
gitk – 查看冲突 |
19
20.
git-diff – 显示提交之间的变化,解决冲突 示例 1.
git status # 查看是否有冲突内容? # Unmerged paths: # (use "git add/rm <file>..." as appropriate to mark resolution) # # both added: demo/conflict.txt 2. git diff # 红色部分 3. Resolve conflict file content, then commit # 伪代码 4. git diff | 20
21.
解决冲突 git commit -am
"merge 'demo' branch" | 21
22.
git-branch – 删除分支 模式 git
branch (-d | -D) [-r] <branchname>… 示例 1. git branch 2. git branch -d demo # “demo”分支必须已完全被合并到上游 分支 3. git branch -D demo # [慎用] 强制删除“demo”分支,即使改 动还未被提交 | 22
23.
git-remote – 管理跟踪的远程仓库集 模式 git
remote [-v] git remote add [--mirror=<fetch|push>] <name> <url> 示例 1. git remote -v # 查看远程仓库地址短别名 2. git remote add origin http://git.intra.weibo.com/huagang1/git_demo.git # 定义远程仓 库地址短别名 | 23
24.
git-fetch – 抓取远程仓库的对象和引用信息 模式 git
fetch <repository> [<refspec>…] 示例 1. git fetch # 更新远程改动 2. git branch -r # 查看远程本地分支 3. gitk master...origin/master # 比较改动内容 4. git status 5. git merge origin/master # 合并远程“master”分支到当前分支 | 24
25.
git-pull – 抓取并合并远程仓库的一个分支 模式 git
pull <repository> [<refspec>…] 示例 1. git checkout master 2. git pull origin master # 合并远程“origin”仓库的“master‖分支 到当前分支 | 25
26.
git-push – 推送本地分支到远程仓库 模式 git
push -u <repository> [<refspec>…] 示例 1. git push -u origin release # 预发布测试分支 2. git push -u origin version # 打Tag(git tag) 3. git push -u origin master # 发布功能 | 26
27.
Workflow | 27
28.
参考资料 [1] Git http://git-scm.com [2] Git
Doc http://git-scm.com/docs/git [3] Git Tutorial http://git-scm.com/docs/gittutorial.html [4] Everyday Git http://git-scm.com/docs/everyday.html [5] Git Basics http://www.slideshare.net/ariejan/git-basics [6] A successful Git branching model - nvie http://nvie.com/posts/a-successful-git-branching-model [译文] http://www.juvenxu.com/2010/11/28/a-successful-git-branching-model https://github.com/nvie/gitflow [7] Git历险记 - InfoQ专栏 http://www.infoq.com/cn/git-adventures [8] Git FAQ https://git.wiki.kernel.org/index.php/Git_FAQ https://help.github.com/ | 28
29.
Q/A
Download now