SlideShare a Scribd company logo
1 of 37
Download to read offline
101502520 過 

2014/08/20
Git ⼰己
2014/12/20
⼰己 ⽅方
他 ...	
• 得⼀一
要⽅方
• 們 是
⽅方
• 是 是 還
他 ...
• ⽅方
• ⽅方
• 是 還
⼰己 就 ⽅方
Git 版本控制就像是⼀一種⾼高級的存檔機制。
開發到⼀一個段落,就可以如存檔⼀一般,提交這次的檔案變動,
並附上提交訊息。
⼰己
• 下 

• 下 

• 下 他 

• 了 他 點

• 果 

• 新 你 你
透過 Git,我們還可以⼗十分清楚
專案整體、各個分⽀支的發展狀況
例如:
哪個分⽀支合併了哪個分⽀支
哪個夥伴最近做了什麼事情
除此之外,透過這個提交機制,
Git 可以:
⽐比較檔案變動的差異
回朔到先前的版本
創⽴立新的分⽀支,並輕鬆合併
Git 這
• 這
• git config --global user.name “Your Name”
• git config --global user.email “your@email.com”
• git config --list 在 這 都
• ⽤用⼼心 Pro Git - 這 Git
Git
• 他 下 無 git init git repository (新⾃自 .git 種)
• .git 種 能 出
• .git/HEAD
• .git/refs/
• .git/HEAD 樣很 你
• .git/refs 種 他 你 tag
.git/refs/heads/master master 你
SHA
• 能 git checkout 每 reset 和
Git ⼤大更
• working directory
.git 種
現以 IDE
⼤大更 

• git directory(repository) .git
種 git 下


• staging area 沒 三
⼤大更 git
commit 下
時 他
他 staging
area 機 

• git repository 下
working directory
Git 他 來
在 來 git status
• git status 和 來

• 做 

• 你 master

• master 那origin/master
下 之

• 他 ⼤大 

• staging area commit 他

• 們 staging
area 他

• git家回 他

• git status -h 在
下 git add & git commit
• 他( ) staging area
• git add <file/directory> <file/directory> … # 他 種
• git add -u # 家回分 他
• git add -A # 家回分 家回 他
• staging area 他 commit
• git commit
• git commit -m “commit message”
他 git rm
• git 家回 他 git repository
git rm
• git rm <file> # 他 working directory
staging area
• git rm <file> --cached # staging area
他 working directory
他 家回
什 他 .gitignore
• 他 我 git 家回 做 IDE 這 每後
真 這 ⼜又 真 他 對
.gitignore 他 這
• 這 更 什 沒
• git config --global core.excludesfile ‘~/.gitignore'
• ⽤用⼼心 Pro Git - ⼜又#什 他
⾃自 你 git branch
• ⾃自 你
你 分地
機 你
• git branch <name> 最 ⾃自 你
git checkout <name> 不到 你
• git checkout -b <name> ⾃自 你
不到
• git branch -a 後 那 你
• git branch -h
新⾃自能 git tag
• 能 (lightweight) 後然
(annotated) 

• 能 能 

• 後然 能 沒 Git (麼
) 

• ⽇日 想 新 後然 能
會 

• git tag -a <name> #新⾃自後然 能 

• git tag <name> #新⾃自 能 

• 能 個 能
v1.0

• ⽤用⼼心 Pro Git - 能
能 你
在 下 git log & git diff
• git diff 在 staging area 他
• git diff --cached 在 他 後 staging area
• git difftool 點 得⼀一在 他
• git log 在 branch 下
• git log -p 在 branch 下 後
• git log --graph 在 commit tree
• git blame <file> 在 他 下
可以查看 staging area 的檔案變動
動 git stash
• 你
git stash 動
• git stash list 在 動
• git stash apply 動
• git stash drop 動
• git stash pop
• ⽤用⼼心 Pro Git - Stashing
git cherry-pick
• git cherry-pick <SHA> <SAH>…
• cherry-pick
commit
HEAD 

• cherry-pick
conflict 就 中
他 staging git
cherry-pick --continue
--abort
不到 你 git checkout
• git checkout <branch/SHA> HEAD (.git/HEAD)
最 working directory
不到 你 commit tree
• 做 git checkout master .git/HEAD
ref: refs/heads/master
• git checkout <SHA> HEAD
detached HEAD 來
你 ⼦子 SHA git branch
git checkout -b dangling commit 新⾃自
你
開 下 git reset
• git reset <SHA> 你 HEAD (.git/refs/heads/
<branch>) 這 detached HEAD 來沒
這 .git/HEAD
• git reset HEAD~2 你
開 unstaged 來
們 對 git add staging area
• --hard 沒 會 working directory
• git reset 開 開
reset reflog 在 開 SHA
git reset <SHA> --hard
git checkout git reset 點
git reset & checkout
• 三 他 兩 reset checkout
HEAD 你 HEAD staging 他
staging 他 git status
了
果 下 git revert
• git revert 果 commit 果
做 下 A->B->C
git revert B A->B->C->D
revert
• git revert HEAD~2 果
• git revert conflict 中 他
git add staging 對 git revert --continue
git revert --abort revert
git revert git reset 點
去發 git rebase
• rebase 你 機 你
你 你
你 rebase 中 就 給好只
你 你 機 中
• rebase 就
git rebase -i HEAD~3 情 ⼀一
情 ⼀一 每
機每 知每 多們
• ⽤用⼼心 Pro Git - 去發
git rebase 了道
git commit --amend
• 對 git rebase -i HEAD~ git commit --amend
下
• git commit --amend staging area
機
沒 staging area
• git rebase 多 git commit --amend ⼈人
SHA 都
那⽽而⼜又 去發
好上
git reflog & git fsck 下
• reset, rebase, commit --amend 和 下
⼿手 ⽅方 Git
• git HEAD 會 成下 git reflog git log -g
在 HEAD 下
• 對 git reflog 在 SHA git reset --
hard <SHA> git merge <SHA> 機
git branch <name> <SHA> ⾃自 下 你
• git reflog SHA git fsck --
full 在 dangling commit SHA 對
• ⽤用⼼心 Pro Git - 多
機 你 git merge
• 你
git merge
你 機 你
• 機
--no-ff
fast forward
對
merge commit
你 機 你
你
新 得 git flow
• git flow git 得
如 道 裡 得 

• 你

• master: 有 來

• develop: 你

• 你 你

• feature: develop
你 機 develop

• release: 看 release
們 bugs develop
機 master develop

• hotfix: 們 bug
master 機 master
develop
那⽽而⼜又 git remote
• git repository 那⽽而⼜又
給好
⽣生 Github Bitbucket 為
三好 這 Gitlab
• git remote -v 他這 那⽽而⼜又
• git remote add <name> <url> 那⽽而⼜又
• git remote -h 在
那 git push
• 那⽽而⼜又
• git push -u <remote> <branch>
• git push -u 你 那 你這
你家回 upstream
• 做 git push -u origin develop develop origin
develop 這 家回 那 origin/develop
• 你 那 做 rebase
push 那 -f 那 你
• 做 git push -u gitlab feature/foo -f
• git push -h 在
那⽽而⼜又 git clone
• git clone <url>
• git clone 那 repository 後
git 下 這 remote
• clone 對 git push
那
• clone git checkout <remote-branch> git
新⾃自 你 remote 你也 這
家回 upstream
• git checkout -b <branch> --track <remote>/<branch>
git fetch & git pull
• git fetch <remote> 那 你
你
• git pull git fetch git merge
git fetch 那家回 你 機
你
• 你 那 你
機 ⼈人 merge commit 新
git pull --rebase rebase merge
時
• git 的 時 道⼩小 做 SHA
• “~” “^” 時 做
• HEAD^2 merge commit
• HEAD~3
• HEAD@{2} HEAD
• 對 “A..B” 時 B 你 A 你
• 對 “A…B” 時 B 你 A 你
• ⽤用⼼心 Pro Git - 時們
次 可
• Git
• Git
• Pro Git
• GitHub Cheat Sheet PDF
• Git Concepts Simplified by Sitaram Chamarty

More Related Content

What's hot

Gitのよく使うコマンド
Gitのよく使うコマンドGitのよく使うコマンド
Gitのよく使うコマンドYUKI Kaoru
 
Gitはじめの一歩
Gitはじめの一歩Gitはじめの一歩
Gitはじめの一歩Ayana Yokota
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git TutorialSage Sharp
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewRueful Robin
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeMd Swawibe Ul Alam
 
Learning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdfLearning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdfJayprakash677449
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucketMedhat Dawoud
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash CourseNilay Binjola
 
ノンプログラマでも今日から使える「Git」でバージョン管理
ノンプログラマでも今日から使える「Git」でバージョン管理ノンプログラマでも今日から使える「Git」でバージョン管理
ノンプログラマでも今日から使える「Git」でバージョン管理H2O Space. Co., Ltd.
 
git, 이해부터 활용까지
git, 이해부터 활용까지git, 이해부터 활용까지
git, 이해부터 활용까지jylee1229
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow IntroductionDavid Paluy
 

What's hot (20)

Gitのよく使うコマンド
Gitのよく使うコマンドGitのよく使うコマンド
Gitのよく使うコマンド
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Gitはじめの一歩
Gitはじめの一歩Gitはじめの一歩
Gitはじめの一歩
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
Git 教學
Git 教學Git 教學
Git 教學
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Source control
Source controlSource control
Source control
 
Git
GitGit
Git
 
Learning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdfLearning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdf
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
今さら聞けない人のためのGitLabの始め方 Ubuntu編
今さら聞けない人のためのGitLabの始め方 Ubuntu編今さら聞けない人のためのGitLabの始め方 Ubuntu編
今さら聞けない人のためのGitLabの始め方 Ubuntu編
 
ノンプログラマでも今日から使える「Git」でバージョン管理
ノンプログラマでも今日から使える「Git」でバージョン管理ノンプログラマでも今日から使える「Git」でバージョン管理
ノンプログラマでも今日から使える「Git」でバージョン管理
 
git, 이해부터 활용까지
git, 이해부터 활용까지git, 이해부터 활용까지
git, 이해부터 활용까지
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 

Viewers also liked

Git 實務圖解
Git 實務圖解Git 實務圖解
Git 實務圖解Pokai Chang
 
Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰Will Huang
 
Git與source tree 基礎教學
Git與source tree 基礎教學Git與source tree 基礎教學
Git與source tree 基礎教學Duncan Chen
 
簡介 GitHub 平台
簡介 GitHub 平台簡介 GitHub 平台
簡介 GitHub 平台Will Huang
 
MS SQL 2012 安裝與基本使用教學
MS SQL 2012 安裝與基本使用教學MS SQL 2012 安裝與基本使用教學
MS SQL 2012 安裝與基本使用教學Yuan Chiu
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用Will Huang
 
SQL Server 資料庫版本控管
SQL Server 資料庫版本控管SQL Server 資料庫版本控管
SQL Server 資料庫版本控管Will Huang
 
Linux 的檔案系統格式介紹
Linux 的檔案系統格式介紹Linux 的檔案系統格式介紹
Linux 的檔案系統格式介紹Ma Yu-Hui
 
Frontend django, Django Web 前端探索
Frontend django, Django Web 前端探索Frontend django, Django Web 前端探索
Frontend django, Django Web 前端探索Tim (文昌)
 
100個網站規劃必備的知識 整合:使用者體驗設計分享
100個網站規劃必備的知識 整合:使用者體驗設計分享100個網站規劃必備的知識 整合:使用者體驗設計分享
100個網站規劃必備的知識 整合:使用者體驗設計分享William Lin
 
Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Ruoshi Ling
 
淺談 Startup 公司的軟體開發流程 v2
淺談 Startup 公司的軟體開發流程 v2淺談 Startup 公司的軟體開發流程 v2
淺談 Startup 公司的軟體開發流程 v2Wen-Tien Chang
 
提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?Chen Cheng-Wei
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideRohit Arora
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners HubSpot
 
電子商務報告 Fb api使用與資料庫安全
電子商務報告 Fb api使用與資料庫安全電子商務報告 Fb api使用與資料庫安全
電子商務報告 Fb api使用與資料庫安全um nop
 

Viewers also liked (20)

Git 實務圖解
Git 實務圖解Git 實務圖解
Git 實務圖解
 
沒有 GUI 的 Git
沒有 GUI 的 Git沒有 GUI 的 Git
沒有 GUI 的 Git
 
Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰Visual Studio 2015 與 Git 開發實戰
Visual Studio 2015 與 Git 開發實戰
 
Git與source tree 基礎教學
Git與source tree 基礎教學Git與source tree 基礎教學
Git與source tree 基礎教學
 
簡介 GitHub 平台
簡介 GitHub 平台簡介 GitHub 平台
簡介 GitHub 平台
 
MS SQL 2012 安裝與基本使用教學
MS SQL 2012 安裝與基本使用教學MS SQL 2012 安裝與基本使用教學
MS SQL 2012 安裝與基本使用教學
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用
 
SQL Server 資料庫版本控管
SQL Server 資料庫版本控管SQL Server 資料庫版本控管
SQL Server 資料庫版本控管
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Linux 的檔案系統格式介紹
Linux 的檔案系統格式介紹Linux 的檔案系統格式介紹
Linux 的檔案系統格式介紹
 
Frontend django, Django Web 前端探索
Frontend django, Django Web 前端探索Frontend django, Django Web 前端探索
Frontend django, Django Web 前端探索
 
100個網站規劃必備的知識 整合:使用者體驗設計分享
100個網站規劃必備的知識 整合:使用者體驗設計分享100個網站規劃必備的知識 整合:使用者體驗設計分享
100個網站規劃必備的知識 整合:使用者體驗設計分享
 
Docker應用
Docker應用Docker應用
Docker應用
 
Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨
 
淺談 Startup 公司的軟體開發流程 v2
淺談 Startup 公司的軟體開發流程 v2淺談 Startup 公司的軟體開發流程 v2
淺談 Startup 公司的軟體開發流程 v2
 
提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?提到 DevOps 到底在談些什麼玩意兒?
提到 DevOps 到底在談些什麼玩意兒?
 
進階主題
進階主題進階主題
進階主題
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guide
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
電子商務報告 Fb api使用與資料庫安全
電子商務報告 Fb api使用與資料庫安全電子商務報告 Fb api使用與資料庫安全
電子商務報告 Fb api使用與資料庫安全
 

Similar to Git 版本控制 (使用教學)

Learn git
Learn gitLearn git
Learn git甘 李
 
Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)Cloud Tu
 
Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)flylon
 
Git 使用介绍
Git 使用介绍Git 使用介绍
Git 使用介绍medcl
 
為自己學 Git
為自己學 Git為自己學 Git
為自己學 Git昀 李
 
COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報Bachue Zhou
 
Git & git flow
Git & git flowGit & git flow
Git & git flowAmo Wu
 
Git 入门实战
Git 入门实战Git 入门实战
Git 入门实战icy leaf
 
Git使用进阶
Git使用进阶Git使用进阶
Git使用进阶Han Qin
 
Git原理与实战 201607
Git原理与实战 201607Git原理与实战 201607
Git原理与实战 201607Charles Tang
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to gitBo-Yi Wu
 
Git introduction
Git introductionGit introduction
Git introductionmythnc
 
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹PingLun Liao
 
Github简介及实用入门
Github简介及实用入门Github简介及实用入门
Github简介及实用入门Rongxing Liu
 
Git Flow 管理
Git Flow 管理Git Flow 管理
Git Flow 管理Pu Lee
 
Git and git hub
Git and git hubGit and git hub
Git and git hub唯 李
 
Git flow 與團隊合作
Git flow 與團隊合作Git flow 與團隊合作
Git flow 與團隊合作Bo-Yi Wu
 
Android 程式設計(4)
Android 程式設計(4)Android 程式設計(4)
Android 程式設計(4)Roy Wang
 
Code review on github training ( beginner )
Code review on github training ( beginner )Code review on github training ( beginner )
Code review on github training ( beginner )JS Lee
 

Similar to Git 版本控制 (使用教學) (20)

Learn git
Learn gitLearn git
Learn git
 
Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)Git tutorial for windows user (給 Windows user 的 Git 教學)
Git tutorial for windows user (給 Windows user 的 Git 教學)
 
Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)Git 超簡單學習懶人包(軟體程式版本控管系統)
Git 超簡單學習懶人包(軟體程式版本控管系統)
 
Git 使用介绍
Git 使用介绍Git 使用介绍
Git 使用介绍
 
為自己學 Git
為自己學 Git為自己學 Git
為自己學 Git
 
COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報COSCUP 2015 開源之道-Git工作坊教學簡報
COSCUP 2015 開源之道-Git工作坊教學簡報
 
Git & git flow
Git & git flowGit & git flow
Git & git flow
 
Git教學
Git教學Git教學
Git教學
 
Git 入门实战
Git 入门实战Git 入门实战
Git 入门实战
 
Git使用进阶
Git使用进阶Git使用进阶
Git使用进阶
 
Git原理与实战 201607
Git原理与实战 201607Git原理与实战 201607
Git原理与实战 201607
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹Git 程式碼版本控制軟體介紹
Git 程式碼版本控制軟體介紹
 
Github简介及实用入门
Github简介及实用入门Github简介及实用入门
Github简介及实用入门
 
Git Flow 管理
Git Flow 管理Git Flow 管理
Git Flow 管理
 
Git and git hub
Git and git hubGit and git hub
Git and git hub
 
Git flow 與團隊合作
Git flow 與團隊合作Git flow 與團隊合作
Git flow 與團隊合作
 
Android 程式設計(4)
Android 程式設計(4)Android 程式設計(4)
Android 程式設計(4)
 
Code review on github training ( beginner )
Code review on github training ( beginner )Code review on github training ( beginner )
Code review on github training ( beginner )
 

More from Jui An Huang (黃瑞安)

Golang PostgreSQL Libraries Comparasion With Wireshark
Golang PostgreSQL Libraries Comparasion With WiresharkGolang PostgreSQL Libraries Comparasion With Wireshark
Golang PostgreSQL Libraries Comparasion With WiresharkJui An Huang (黃瑞安)
 
Scaling Offline Database Usage On GCP @ Dcard
Scaling Offline Database Usage On GCP @ DcardScaling Offline Database Usage On GCP @ Dcard
Scaling Offline Database Usage On GCP @ DcardJui An Huang (黃瑞安)
 
Www 2017第二次新生訓練:系統設計
Www 2017第二次新生訓練:系統設計Www 2017第二次新生訓練:系統設計
Www 2017第二次新生訓練:系統設計Jui An Huang (黃瑞安)
 
Www 2017第一次新生訓練:系統分析
Www 2017第一次新生訓練:系統分析Www 2017第一次新生訓練:系統分析
Www 2017第一次新生訓練:系統分析Jui An Huang (黃瑞安)
 
Www 2017第三次新生訓練:transaction, migration, worker
Www 2017第三次新生訓練:transaction, migration, workerWww 2017第三次新生訓練:transaction, migration, worker
Www 2017第三次新生訓練:transaction, migration, workerJui An Huang (黃瑞安)
 
Elasitcsearch + Logstash + Kibana 日誌監控
Elasitcsearch + Logstash + Kibana 日誌監控Elasitcsearch + Logstash + Kibana 日誌監控
Elasitcsearch + Logstash + Kibana 日誌監控Jui An Huang (黃瑞安)
 

More from Jui An Huang (黃瑞安) (7)

Golang PostgreSQL Libraries Comparasion With Wireshark
Golang PostgreSQL Libraries Comparasion With WiresharkGolang PostgreSQL Libraries Comparasion With Wireshark
Golang PostgreSQL Libraries Comparasion With Wireshark
 
Scaling Offline Database Usage On GCP @ Dcard
Scaling Offline Database Usage On GCP @ DcardScaling Offline Database Usage On GCP @ Dcard
Scaling Offline Database Usage On GCP @ Dcard
 
Www 2017第二次新生訓練:系統設計
Www 2017第二次新生訓練:系統設計Www 2017第二次新生訓練:系統設計
Www 2017第二次新生訓練:系統設計
 
Www 2017第一次新生訓練:系統分析
Www 2017第一次新生訓練:系統分析Www 2017第一次新生訓練:系統分析
Www 2017第一次新生訓練:系統分析
 
Www 2017第三次新生訓練:transaction, migration, worker
Www 2017第三次新生訓練:transaction, migration, workerWww 2017第三次新生訓練:transaction, migration, worker
Www 2017第三次新生訓練:transaction, migration, worker
 
Elasitcsearch + Logstash + Kibana 日誌監控
Elasitcsearch + Logstash + Kibana 日誌監控Elasitcsearch + Logstash + Kibana 日誌監控
Elasitcsearch + Logstash + Kibana 日誌監控
 
Elasticsearch 簡介
Elasticsearch 簡介Elasticsearch 簡介
Elasticsearch 簡介
 

Git 版本控制 (使用教學)

  • 1. 101502520 過 2014/08/20 Git ⼰己 2014/12/20
  • 3. 他 ... • 得⼀一 要⽅方 • 們 是 ⽅方 • 是 是 還
  • 4. 他 ... • ⽅方 • ⽅方 • 是 還
  • 5. ⼰己 就 ⽅方 Git 版本控制就像是⼀一種⾼高級的存檔機制。 開發到⼀一個段落,就可以如存檔⼀一般,提交這次的檔案變動, 並附上提交訊息。
  • 6. ⼰己 • 下 • 下 • 下 他 • 了 他 點 • 果 • 新 你 你 透過 Git,我們還可以⼗十分清楚 專案整體、各個分⽀支的發展狀況 例如: 哪個分⽀支合併了哪個分⽀支 哪個夥伴最近做了什麼事情 除此之外,透過這個提交機制, Git 可以: ⽐比較檔案變動的差異 回朔到先前的版本 創⽴立新的分⽀支,並輕鬆合併
  • 7. Git 這 • 這 • git config --global user.name “Your Name” • git config --global user.email “your@email.com” • git config --list 在 這 都 • ⽤用⼼心 Pro Git - 這 Git
  • 8. Git • 他 下 無 git init git repository (新⾃自 .git 種) • .git 種 能 出 • .git/HEAD • .git/refs/ • .git/HEAD 樣很 你 • .git/refs 種 他 你 tag .git/refs/heads/master master 你 SHA • 能 git checkout 每 reset 和
  • 9. Git ⼤大更 • working directory .git 種 現以 IDE ⼤大更 • git directory(repository) .git 種 git 下 • staging area 沒 三 ⼤大更 git commit 下 時 他 他 staging area 機 • git repository 下 working directory
  • 11. 在 來 git status • git status 和 來 • 做 • 你 master • master 那origin/master 下 之 • 他 ⼤大 • staging area commit 他 • 們 staging area 他 • git家回 他 • git status -h 在
  • 12. 下 git add & git commit • 他( ) staging area • git add <file/directory> <file/directory> … # 他 種 • git add -u # 家回分 他 • git add -A # 家回分 家回 他 • staging area 他 commit • git commit • git commit -m “commit message”
  • 13. 他 git rm • git 家回 他 git repository git rm • git rm <file> # 他 working directory staging area • git rm <file> --cached # staging area 他 working directory 他 家回
  • 14. 什 他 .gitignore • 他 我 git 家回 做 IDE 這 每後 真 這 ⼜又 真 他 對 .gitignore 他 這 • 這 更 什 沒 • git config --global core.excludesfile ‘~/.gitignore' • ⽤用⼼心 Pro Git - ⼜又#什 他
  • 15. ⾃自 你 git branch • ⾃自 你 你 分地 機 你 • git branch <name> 最 ⾃自 你 git checkout <name> 不到 你 • git checkout -b <name> ⾃自 你 不到 • git branch -a 後 那 你 • git branch -h
  • 16. 新⾃自能 git tag • 能 (lightweight) 後然 (annotated) • 能 能 • 後然 能 沒 Git (麼 ) • ⽇日 想 新 後然 能 會 • git tag -a <name> #新⾃自後然 能 • git tag <name> #新⾃自 能 • 能 個 能 v1.0 • ⽤用⼼心 Pro Git - 能 能 你
  • 17. 在 下 git log & git diff • git diff 在 staging area 他 • git diff --cached 在 他 後 staging area • git difftool 點 得⼀一在 他 • git log 在 branch 下 • git log -p 在 branch 下 後 • git log --graph 在 commit tree • git blame <file> 在 他 下 可以查看 staging area 的檔案變動
  • 18. 動 git stash • 你 git stash 動 • git stash list 在 動 • git stash apply 動 • git stash drop 動 • git stash pop • ⽤用⼼心 Pro Git - Stashing
  • 19. git cherry-pick • git cherry-pick <SHA> <SAH>… • cherry-pick commit HEAD • cherry-pick conflict 就 中 他 staging git cherry-pick --continue --abort
  • 20. 不到 你 git checkout • git checkout <branch/SHA> HEAD (.git/HEAD) 最 working directory 不到 你 commit tree • 做 git checkout master .git/HEAD ref: refs/heads/master • git checkout <SHA> HEAD detached HEAD 來 你 ⼦子 SHA git branch git checkout -b dangling commit 新⾃自 你
  • 21. 開 下 git reset • git reset <SHA> 你 HEAD (.git/refs/heads/ <branch>) 這 detached HEAD 來沒 這 .git/HEAD • git reset HEAD~2 你 開 unstaged 來 們 對 git add staging area • --hard 沒 會 working directory • git reset 開 開 reset reflog 在 開 SHA git reset <SHA> --hard
  • 22. git checkout git reset 點
  • 23. git reset & checkout • 三 他 兩 reset checkout HEAD 你 HEAD staging 他 staging 他 git status 了
  • 24. 果 下 git revert • git revert 果 commit 果 做 下 A->B->C git revert B A->B->C->D revert • git revert HEAD~2 果 • git revert conflict 中 他 git add staging 對 git revert --continue git revert --abort revert
  • 25. git revert git reset 點
  • 26. 去發 git rebase • rebase 你 機 你 你 你 你 rebase 中 就 給好只 你 你 機 中 • rebase 就 git rebase -i HEAD~3 情 ⼀一 情 ⼀一 每 機每 知每 多們 • ⽤用⼼心 Pro Git - 去發
  • 28. git commit --amend • 對 git rebase -i HEAD~ git commit --amend 下 • git commit --amend staging area 機 沒 staging area • git rebase 多 git commit --amend ⼈人 SHA 都 那⽽而⼜又 去發 好上
  • 29. git reflog & git fsck 下 • reset, rebase, commit --amend 和 下 ⼿手 ⽅方 Git • git HEAD 會 成下 git reflog git log -g 在 HEAD 下 • 對 git reflog 在 SHA git reset -- hard <SHA> git merge <SHA> 機 git branch <name> <SHA> ⾃自 下 你 • git reflog SHA git fsck -- full 在 dangling commit SHA 對 • ⽤用⼼心 Pro Git - 多
  • 30. 機 你 git merge • 你 git merge 你 機 你 • 機 --no-ff fast forward 對 merge commit 你 機 你 你
  • 31. 新 得 git flow • git flow git 得 如 道 裡 得 • 你 • master: 有 來 • develop: 你 • 你 你 • feature: develop 你 機 develop • release: 看 release 們 bugs develop 機 master develop • hotfix: 們 bug master 機 master develop
  • 32. 那⽽而⼜又 git remote • git repository 那⽽而⼜又 給好 ⽣生 Github Bitbucket 為 三好 這 Gitlab • git remote -v 他這 那⽽而⼜又 • git remote add <name> <url> 那⽽而⼜又 • git remote -h 在
  • 33. 那 git push • 那⽽而⼜又 • git push -u <remote> <branch> • git push -u 你 那 你這 你家回 upstream • 做 git push -u origin develop develop origin develop 這 家回 那 origin/develop • 你 那 做 rebase push 那 -f 那 你 • 做 git push -u gitlab feature/foo -f • git push -h 在
  • 34. 那⽽而⼜又 git clone • git clone <url> • git clone 那 repository 後 git 下 這 remote • clone 對 git push 那 • clone git checkout <remote-branch> git 新⾃自 你 remote 你也 這 家回 upstream • git checkout -b <branch> --track <remote>/<branch>
  • 35. git fetch & git pull • git fetch <remote> 那 你 你 • git pull git fetch git merge git fetch 那家回 你 機 你 • 你 那 你 機 ⼈人 merge commit 新 git pull --rebase rebase merge
  • 36. 時 • git 的 時 道⼩小 做 SHA • “~” “^” 時 做 • HEAD^2 merge commit • HEAD~3 • HEAD@{2} HEAD • 對 “A..B” 時 B 你 A 你 • 對 “A…B” 時 B 你 A 你 • ⽤用⼼心 Pro Git - 時們
  • 37. 次 可 • Git • Git • Pro Git • GitHub Cheat Sheet PDF • Git Concepts Simplified by Sitaram Chamarty