SlideShare a Scribd company logo
1 of 52
Download to read offline
Outline
● What is “git” ?
● Glossary
● Git Clients
● Basic Setup
● Working Model
● Life Cycle
● Basic Operations
● Better Practices
●
● Q&A
What is ‘git’ ?
● a distributed version control system
● a powerful version control tool
● and more...
Glossary
●
●
●
●
●
●
●
●
●
●
●
●
●
●
●
https://git-scm.com/docs/gitglossary
Git Clients
https://www.iconfinder.com/iconsets/flat-round-system
https://git-scm.com/downloads/guis
Basic Setup
●
○
●
○
* optional flag
Working Model
Local Centralized
(most case)
Distributed
(github, bitbucket, etc.)
https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control
Life Cycle
Life Cycle
Untracked Staged UnstagedCommitted
object state action
Life Cycle
Untracked Staged UnstagedCommitted
object state action
Life Cycle
Untracked Staged UnstagedCommitted
object state action
Life Cycle
Untracked Staged UnstagedCommitted
object state action
Basic Operations
Basic Operations
Untracked Staged UnstagedCommitted
object state action
new objects
Basic Operations
Untracked Staged UnstagedCommitted
object state action
new objects
$ git init
Basic Operations
Untracked Staged UnstagedCommitted
object state action
new objects
$ git init
Basic Operations
Untracked Staged UnstagedCommitted
object state action
new objects
$ git init $ git add stages objects
Basic Operations
Untracked Staged UnstagedCommitted
object state action
new objects
$ git init $ git add stages objects
$ git
commit
commited objects
now, objects in version control
What’s a commit?
change summaries
change descriptions
author infomation
unique id
git “commit”
Basic Operations
Untracked Staged UnstagedCommitted
object state action
new objects
$ git init $ git add stages objects
$ git
commit
commited objects
something changed !!!
commited objects### objects changes ###
Basic Operations
Untracked Staged UnstagedCommitted
object state action
New objects
$ git init $ git add Stages objects
$ git
commit
Commited objects
changes is now in version control
but having no change descriptions
Unstaged objects### objects changes ###
$ git addStages objects
Basic Operations
Untracked Staged UnstagedCommitted
object state action
New objects
$ git init $ git add Stages objects
$ git
commit
Commited objects
Unstaged objects### objects changes ###
$ git addStages objects
changes is now in version control
with commit descriptions
$ git
commit
Commited objects
Basic Operations
Untracked Staged UnstagedCommitted
object state action
New objects
$ git init $ git add Stages objects
$ git
commit
Commited objects
Unstaged objects### objects changes ###
$ git addStages objects
$ git
commit
Commited objects
Staged objects$ git rm
Basic Operations
Untracked Staged UnstagedCommitted
object state action
New objects
$ git init $ git add Stages objects
$ git
commit
Commited objects
Unstaged objects### objects changes ###
$ git addStages objects
$ git
commit
Commited objects
Staged objects$ git rm
$ git
commit
Commited objects
Object State & Change
Untracked Staged UnstagedCommitted
action
$ git diff
Untracked Staged UnstagedCommitted
action
$ git diff
$ git diff --cached
Object State & Change
Basic Operations (local)
●
●
●
●
●
●
●
Basic Operations (remote)
●
●
●
●
●
●
Better Practices
●
Better Practices
●
●
Subject, length <= 50 chars
But… information not enough
Better Practices
●
●
Better~!!!
Subject, length <= 50 chars
Subject, length <= 50 chars
Blank line between long descriptions and subject
long descriptions, length <= 72 chars
exception: long link, email, etc.
Even Better~!
Take responsibility for your commits :-)
Better Practices
●
●
●
●
http://lmgtfy.com/?q=git+lesson+one
http://lmgtfy.com/?q=git+branch+model
http://lmgtfy.com/?q=git+flow
http://nvie.com/posts/a-successful-git-branching-model/
Advanced Lesson
Advance Operations
●
●
●
●
* commit histroy will be changed, danger!!!
Advance - git revert
A B C D E
HEAD, master
$ git revert D
before change:
A B C D E
HEAD, master
D’
Advance - git reset (1/3)
A B C D E
HEAD, master
$ git reset C
before change:
A B C D E
HEAD, master
Advance - git reset (2/3)
A B C D E
HEAD, master
$ git reset --soft C
before change:
A B C D E
HEAD, master
Advance - git reset (3/3)
A B C D E
HEAD, master
$ git reset --hard C
before change:
A B C
HEAD, master
Advance - git cherry-pick
$ git cherry-pick Y
before change:
A B C D E
HEAD, masterX Y Z
A B C D E
HEAD, masterX Y Z
Y’
feature-A
feature-A
Advance - git rebase
$ git rebase C
before change:
A B C
HEAD, feature -A
X’ Y’ Z’
A B C
HEAD, feature-A
X Y Z
master
master
Advance - git merge (1/4)
$ git merge <branch>
before change:
A B
HEAD, master
X Y Z
HEAD, master, feature-A
A B X Y Z
feature-A
Advance - git merge (2/4)
$ git merge --ff <branch>
before change:
A B
X Y Z
HEAD, master, feature-A
A B X Y Z
HEAD, master
feature-A
Advance - git merge (3/4)
$ git merge --no-ff <branch>
before change:
A B
X Y Z
M
HEAD, master
A B
X Y Z
HEAD, master
feature-A
feature-A
Advance - git merge (4/4)
$ git merge <branch>
$ git merge --ff <branch>
$ git merge --no-ff <branch>
before change:
A B C D E
HEAD, masterX Y Z
A B C D E
X Y Z
M
HEAD, master
feature-A
feature-A
Advance - git pull (1/3)
$ git pull
before change:
A B C D E
HEAD, master origin/master
A B C D E
HEAD, master, origin/master
Advance - git pull (2/3)
$ git pull
before change:
A B C
D E
HEAD, master
origin/master
A B C
D E
HEAD, master
origin/master
M
Advance - git pull (3/3)
$ git pull --rebase
before change:
A B C
D E
origin/master
A B D E C’
HEAD, masterorigin/master
HEAD, master
Useful Links
●
○
○
○
○
○
●
○
○
○
○
Best Tutorials
●
○
●
○
●
○
Question Time
The End~

More Related Content

What's hot

Git: A Getting Started Presentation
Git: A Getting Started PresentationGit: A Getting Started Presentation
Git: A Getting Started Presentation
Nap Ramirez
 
Open Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git HubOpen Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git Hub
Nick Quaranto
 

What's hot (20)

Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
 
Git & GitHub for Beginners
Git & GitHub for BeginnersGit & GitHub for Beginners
Git & GitHub for Beginners
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
 
Git: A Getting Started Presentation
Git: A Getting Started PresentationGit: A Getting Started Presentation
Git: A Getting Started Presentation
 
Git internals
Git internalsGit internals
Git internals
 
Git basics for beginners
Git basics for beginnersGit basics for beginners
Git basics for beginners
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
 
Git and git hub
Git and git hubGit and git hub
Git and git hub
 
Open Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git HubOpen Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git Hub
 
Git and github fundamental
Git and github fundamentalGit and github fundamental
Git and github fundamental
 
Git advanced
Git advancedGit advanced
Git advanced
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git Tutorial I
Git Tutorial IGit Tutorial I
Git Tutorial I
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 

Viewers also liked

Hiiir 資安講座 IV 伺服器端攻擊與防禦I
Hiiir 資安講座 IV 伺服器端攻擊與防禦IHiiir 資安講座 IV 伺服器端攻擊與防禦I
Hiiir 資安講座 IV 伺服器端攻擊與防禦I
Hiiir Lab
 
資安人員如何協助企業面對層出不窮的資安威脅
資安人員如何協助企業面對層出不窮的資安威脅 資安人員如何協助企業面對層出不窮的資安威脅
資安人員如何協助企業面對層出不窮的資安威脅
Tim Hsu
 
Java SE 7 技術手冊投影片第 01 章 - Java平台概論
Java SE 7 技術手冊投影片第 01 章 - Java平台概論Java SE 7 技術手冊投影片第 01 章 - Java平台概論
Java SE 7 技術手冊投影片第 01 章 - Java平台概論
Justin Lin
 
Design Patterns這樣學就會了:入門班 Day1 教材
Design Patterns這樣學就會了:入門班 Day1 教材Design Patterns這樣學就會了:入門班 Day1 教材
Design Patterns這樣學就會了:入門班 Day1 教材
teddysoft
 

Viewers also liked (19)

Git 經驗分享
Git 經驗分享Git 經驗分享
Git 經驗分享
 
個人電腦/網站的資訊安全:給非營利組織的建議
個人電腦/網站的資訊安全:給非營利組織的建議個人電腦/網站的資訊安全:給非營利組織的建議
個人電腦/網站的資訊安全:給非營利組織的建議
 
FreeTalk: 企業資安下之工程師成長歷程
 FreeTalk: 企業資安下之工程師成長歷程 FreeTalk: 企業資安下之工程師成長歷程
FreeTalk: 企業資安下之工程師成長歷程
 
Hiiir 資安講座 IV 伺服器端攻擊與防禦I
Hiiir 資安講座 IV 伺服器端攻擊與防禦IHiiir 資安講座 IV 伺服器端攻擊與防禦I
Hiiir 資安講座 IV 伺服器端攻擊與防禦I
 
渗透测试思路技术与方法
渗透测试思路技术与方法渗透测试思路技术与方法
渗透测试思路技术与方法
 
Git flow 與團隊合作
Git flow 與團隊合作Git flow 與團隊合作
Git flow 與團隊合作
 
不能承受的感動 - iOS App實機測試
不能承受的感動 - iOS App實機測試不能承受的感動 - iOS App實機測試
不能承受的感動 - iOS App實機測試
 
Got Your PW - 一場入門資安的微旅行
Got Your PW - 一場入門資安的微旅行Got Your PW - 一場入門資安的微旅行
Got Your PW - 一場入門資安的微旅行
 
資安人員如何協助企業面對層出不窮的資安威脅
資安人員如何協助企業面對層出不窮的資安威脅 資安人員如何協助企業面對層出不窮的資安威脅
資安人員如何協助企業面對層出不窮的資安威脅
 
DARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
DARPA CGC and DEFCON CTF: Automatic Attack and Defense TechniqueDARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
DARPA CGC and DEFCON CTF: Automatic Attack and Defense Technique
 
Java SE 7 技術手冊投影片第 01 章 - Java平台概論
Java SE 7 技術手冊投影片第 01 章 - Java平台概論Java SE 7 技術手冊投影片第 01 章 - Java平台概論
Java SE 7 技術手冊投影片第 01 章 - Java平台概論
 
CP 值很高的 Gulp
CP 值很高的 GulpCP 值很高的 Gulp
CP 值很高的 Gulp
 
PHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding stylePHP & JavaScript & CSS Coding style
PHP & JavaScript & CSS Coding style
 
AdWords廣告基礎 懶人包
AdWords廣告基礎 懶人包AdWords廣告基礎 懶人包
AdWords廣告基礎 懶人包
 
Design Patterns這樣學就會了:入門班 Day1 教材
Design Patterns這樣學就會了:入門班 Day1 教材Design Patterns這樣學就會了:入門班 Day1 教材
Design Patterns這樣學就會了:入門班 Day1 教材
 
用十分鐘瞭解 《開放原始碼的世界》
用十分鐘瞭解  《開放原始碼的世界》用十分鐘瞭解  《開放原始碼的世界》
用十分鐘瞭解 《開放原始碼的世界》
 
用十分鐘快速掌握《數學的整體結構》
用十分鐘快速掌握《數學的整體結構》用十分鐘快速掌握《數學的整體結構》
用十分鐘快速掌握《數學的整體結構》
 
Visual Studio Code 快速上手指南
Visual Studio Code 快速上手指南Visual Studio Code 快速上手指南
Visual Studio Code 快速上手指南
 
[系列活動] 機器學習速遊
[系列活動] 機器學習速遊[系列活動] 機器學習速遊
[系列活動] 機器學習速遊
 

Similar to Git - a powerful version control tool

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
Victor Wong
 

Similar to Git - a powerful version control tool (20)

Loading...git
Loading...gitLoading...git
Loading...git
 
Git beyond basics
Git   beyond basicsGit   beyond basics
Git beyond basics
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Get Good With Git
Get Good With GitGet Good With Git
Get Good With Git
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git Aliases of the Gods!
Git Aliases of the Gods!Git Aliases of the Gods!
Git Aliases of the Gods!
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
 
Introduction to GIT
Introduction to GITIntroduction to GIT
Introduction to GIT
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it Again
 
Jedi Mind Tricks in Git
Jedi Mind Tricks in GitJedi Mind Tricks in Git
Jedi Mind Tricks in Git
 
Git
GitGit
Git
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for Git
 
Introducción a git y GitHub
Introducción a git y GitHubIntroducción a git y GitHub
Introducción a git y GitHub
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 

Recently uploaded

No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
Sheetaleventcompany
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
Kayode Fayemi
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
raffaeleoman
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
Kayode Fayemi
 

Recently uploaded (20)

ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
No Advance 8868886958 Chandigarh Call Girls , Indian Call Girls For Full Nigh...
 
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 93 Noida Escorts >༒8448380779 Escort Service
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)Introduction to Prompt Engineering (Focusing on ChatGPT)
Introduction to Prompt Engineering (Focusing on ChatGPT)
 
Air breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animalsAir breathing and respiratory adaptations in diver animals
Air breathing and respiratory adaptations in diver animals
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
 
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
 
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 97 Noida Escorts >༒8448380779 Escort Service
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
SaaStr Workshop Wednesday w/ Lucas Price, Yardstick
SaaStr Workshop Wednesday w/ Lucas Price, YardstickSaaStr Workshop Wednesday w/ Lucas Price, Yardstick
SaaStr Workshop Wednesday w/ Lucas Price, Yardstick
 
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510
 

Git - a powerful version control tool