SlideShare a Scribd company logo
git
Yeast Liu
2014.04.01 @ NISRA
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
Outline
• About Version Control
• What is “Version Control” ?
• Version Control Systems
• Local Version Control Systems
• Centralized Version Control Systems
• Distributed Version Control Systems
• Hello, Git!
• Git GUI
• Git Branching
About Version Control
• What is version control ?
• Local Version Control Systems
• 在 local 各自建立版本資料庫
• 協作開發困難
• Centralized Version Control Systems
• 利用一台中央 Server 儲存所有版本紀錄
• SVN ( Subversion )
• Server 負擔大
• Distributed Version Control Systems
• 每個 local 都有一個版本資料庫
• git
Local Version Control Systems
commit
Centralized Version Control Systems
commit
Distributed
Version Control
Systems
commit
push/pull
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Git Basics
• Git and Github
• Git GUI
• Git Branching
What is Git?
• A distributed version control system.
• Designed and developed by Linus Torvalds.
• A distributed revision control and source code
management system.
What is Git? – Other VCS
• Store data as changes.
What is Git? – Git VCS
• DAG ( Directed Acyclic Graph):
Store data as snapshots.
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Installing Git
• First-Time Git Setup
• Get Help
• Git Basics
• Git and Github
• Git GUI
• Git Branching
Getting Started : Installing Git
• Install git on Windows
• Install git on Ubuntu
$ sudo apt-get install git
http://msysgit.github.io/
Getting Started : Git Setup
$ git config --global user.name “Your Name”
• First-Time git setup
$ git config --global user.email “Your Email”
Getting Started : Git Setup
$ cat ~/.gitconfig or
$ vim ~/.gitconfig or
$ git config –list
• Check your git configuration.
• ~/.gitconfig
• 是隱藏在 home folder 中的設定檔
Getting Started : Getting Help
$ git help <command> or
$ git <command> --help
• Get the manual page for help.
$ git help config
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Git Basics
• Git Repository
• Commands
• Git and Github
• Git GUI
• Git Branching
Getting Basics : Git Repository (Repo)
• Repositories
• 一個儲存專案中所有修訂資訊、歷史紀錄的資料庫
• .git 是一個隱藏目錄, 存放 Repo 所需要的資訊.
Getting Basics : Git Repository (Repo)
Git Basics : Git Repository (Repo)
• Git Repo : 一個被 Git 追蹤的專案
• Repo stored the collection of files and their
complete history.
Git Basics : Git Repository (Repo)
3
3
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Git Basics
• Git Repository
• Commands
• Git and Github
• Git GUI
• Git Branching
Git Basics : Commands
• Create a empty directory.
• Create git repository.
$ mkdir hellogit
$ cd hellogit
$ git init
Git Basics : Commands
• Create content
• Show content
$ touch data.txt
$ echo “content” > data.txt
$ echo “concat” >> data.txt
$ cat data.txt
Git Basics : Commands
• See the current status.
$ git status
Git Basics : Commands
• Add file to the staging area.
$ git add data.txt
$ git add .
Git Basics : Commands
• Remove file to the staging area.
$ git rm data.txt
Git Basics : Commands
• Commit file to the local repository.
$ git commit –m “Your commit msg”
Git Basics : Commands
• Show git log for the change.
$ git log
Outline
• About Version Control
• Hello, Git!
• What is Git?
• Getting Started
• Git Basics
• Git and Github
• Git GUI
• Git Branching
Git
• Make a new repository on GitHub.
Github : Git and Github
• Make a new repository on GitHub.
Github : Git and Github
“Your Repo Name”
• Creates a remote named “origin” pointing at
your github repo.
Github : Git and Github
$ git remote add origin “URL”
“ URL ”
• Push your commit.
Github : Git and Github
$ git push origin master
• Push your commit.
Github : Git and Github
$ git push origin master
• Push your commit.
Github : Git and Github
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
Git GUI
• Graphical Git Client for Linux
• Git-cola
• Gitg
• SmartGit
• Giggle
• Git Gui
• qGit
• gitk
Git GUI
• Gitk
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
• Data Structures
• About Branching
• Merge Branches
Git Branching : Data Structures
紀錄檔案內容
檔案目錄
紀錄訊息
Git Branching : Data Structures
• Single commit repository data.
Git Branching : Data Structures
• Git object data for multiple commits.
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
• Data Structures
• About Branching
• Merge Branches
Git Branching: About Branching
• Create a new branch.
$ git branch testing
“ Your branch name”
Git Branching: About Branching
• Switch to an existing branch.
$ git checkout testing
“ Your branch name”
Git Branching: About Branching
• Switch to an existing branch.
$ git checkout testing
“ Your branch name”
Outline
• About Version Control
• Hello, Git!
• Git GUI
• Git Branching
• Data Structures
• About Branching
• Merge Branches
Git Branching: Merge Branches
$ git checkout –b iss53
“ Your branch name”
Git Branching: Merge Branches
index.html
$ vim index.html
$ git add
$ git commit –m “issue 53”
index.html
index.html
$ git checkout master
$ git checkout –b hotfix
$ vim index.html
$ vim add
$ git commit –m “hotfix”
index.html
index.html
$ git checkout master
$ git merge hotfix
$ git branch –d hotfix
$ git checkout master
$ git merge iss53
master and iss53 :
no common ancestors
master and iss53 :
no common ancestors
Reference
• Git Documentation
• http://git-scm.com/documentation
• 版本控制系統Git 精要| ihower 的Git 教室
• http://ihower.tw/git/remote.html
• 寫給大家的Git 教學
• http://www.slideshare.net/littlebtc/git-5528339
Q & A 愚人節快樂 :)

More Related Content

PPTX
Learn Git - For Beginners and Intermediate levels
PPTX
Mahara UK 2011 Technical Day - Git for Mahara
PDF
Git workshop
PDF
Git study notes
ODP
Git: Git'ing the Basic
PPTX
Workshop on Git and GitHub
Learn Git - For Beginners and Intermediate levels
Mahara UK 2011 Technical Day - Git for Mahara
Git workshop
Git study notes
Git: Git'ing the Basic
Workshop on Git and GitHub

What's hot (20)

PPTX
Git locally - part 1
PPTX
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
PDF
Introduction to Git
PPTX
Davinci git brown_bag
PPTX
Git-Basics
PPTX
Git n git hub
PDF
APNIC Hackathon The Lord of IPv6
PPTX
Git session Dropsolid.com
PDF
Git presentation
ODP
An introductory guide to GIT
PDF
The Basics of Open Source Collaboration With Git and GitHub
PDF
Git, GitHub and Open Source
PPTX
An introduction to git
PDF
Git journey from mars to neon EclipseCon North America - 2016-03-08
PPTX
Introduction to github slideshare
PPTX
Git and github fundamentals
PPTX
Make Git Understand Excel Workbooks - Eusprig 2018
PDF
GitHub
PPTX
Git tutorial git branches 20131206-Bryan
PPTX
Git intro - agilsun
Git locally - part 1
Git workshop - University of Moratuwa, Department of Computer Science and Eng...
Introduction to Git
Davinci git brown_bag
Git-Basics
Git n git hub
APNIC Hackathon The Lord of IPv6
Git session Dropsolid.com
Git presentation
An introductory guide to GIT
The Basics of Open Source Collaboration With Git and GitHub
Git, GitHub and Open Source
An introduction to git
Git journey from mars to neon EclipseCon North America - 2016-03-08
Introduction to github slideshare
Git and github fundamentals
Make Git Understand Excel Workbooks - Eusprig 2018
GitHub
Git tutorial git branches 20131206-Bryan
Git intro - agilsun
Ad

Similar to Git (20)

PDF
版本控制Git
PDF
簡單介紹git
PDF
Git: basic to advanced
PPTX
Git basic
PDF
GTFO: Git Theory For OpenSource
PPTX
Git essential training & sharing self
PDF
GIT_GITHUB_2016_06_17
PDF
Git 入门 与 实践
PPT
Git training
PDF
Git 入门与实践
PDF
PDF
Git 基础
KEY
Let's Git this Party Started: An Introduction to Git and GitHub
PPTX
Git 101 for_tarad_dev
KEY
Git Tech Talk
PDF
Svn to-git
PDF
Git and Github
PPT
Git presentation
PDF
Distributed Developer Workflows using Git
PDF
ePOM - Fundamentals of Research Software Development - Code Version Control
版本控制Git
簡單介紹git
Git: basic to advanced
Git basic
GTFO: Git Theory For OpenSource
Git essential training & sharing self
GIT_GITHUB_2016_06_17
Git 入门 与 实践
Git training
Git 入门与实践
Git 基础
Let's Git this Party Started: An Introduction to Git and GitHub
Git 101 for_tarad_dev
Git Tech Talk
Svn to-git
Git and Github
Git presentation
Distributed Developer Workflows using Git
ePOM - Fundamentals of Research Software Development - Code Version Control
Ad

Recently uploaded (20)

DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
1_English_Language_Set_2.pdf probationary
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Classroom Observation Tools for Teachers
PDF
Hazard Identification & Risk Assessment .pdf
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
Unit 4 Skeletal System.ppt.pptxopresentatiom
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
UNIT III MENTAL HEALTH NURSING ASSESSMENT
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
1_English_Language_Set_2.pdf probationary
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Final Presentation General Medicine 03-08-2024.pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Supply Chain Operations Speaking Notes -ICLT Program
Classroom Observation Tools for Teachers
Hazard Identification & Risk Assessment .pdf
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
Unit 4 Skeletal System.ppt.pptxopresentatiom
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
UNIT III MENTAL HEALTH NURSING ASSESSMENT
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
SOIL: Factor, Horizon, Process, Classification, Degradation, Conservation

Git

  • 2. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching
  • 3. Outline • About Version Control • What is “Version Control” ? • Version Control Systems • Local Version Control Systems • Centralized Version Control Systems • Distributed Version Control Systems • Hello, Git! • Git GUI • Git Branching
  • 4. About Version Control • What is version control ? • Local Version Control Systems • 在 local 各自建立版本資料庫 • 協作開發困難 • Centralized Version Control Systems • 利用一台中央 Server 儲存所有版本紀錄 • SVN ( Subversion ) • Server 負擔大 • Distributed Version Control Systems • 每個 local 都有一個版本資料庫 • git
  • 5. Local Version Control Systems commit
  • 8. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Git Basics • Git and Github • Git GUI • Git Branching
  • 9. What is Git? • A distributed version control system. • Designed and developed by Linus Torvalds. • A distributed revision control and source code management system.
  • 10. What is Git? – Other VCS • Store data as changes.
  • 11. What is Git? – Git VCS • DAG ( Directed Acyclic Graph): Store data as snapshots.
  • 12. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Installing Git • First-Time Git Setup • Get Help • Git Basics • Git and Github • Git GUI • Git Branching
  • 13. Getting Started : Installing Git • Install git on Windows • Install git on Ubuntu $ sudo apt-get install git http://msysgit.github.io/
  • 14. Getting Started : Git Setup $ git config --global user.name “Your Name” • First-Time git setup $ git config --global user.email “Your Email”
  • 15. Getting Started : Git Setup $ cat ~/.gitconfig or $ vim ~/.gitconfig or $ git config –list • Check your git configuration. • ~/.gitconfig • 是隱藏在 home folder 中的設定檔
  • 16. Getting Started : Getting Help $ git help <command> or $ git <command> --help • Get the manual page for help. $ git help config
  • 17. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Git Basics • Git Repository • Commands • Git and Github • Git GUI • Git Branching
  • 18. Getting Basics : Git Repository (Repo) • Repositories • 一個儲存專案中所有修訂資訊、歷史紀錄的資料庫 • .git 是一個隱藏目錄, 存放 Repo 所需要的資訊.
  • 19. Getting Basics : Git Repository (Repo)
  • 20. Git Basics : Git Repository (Repo) • Git Repo : 一個被 Git 追蹤的專案 • Repo stored the collection of files and their complete history.
  • 21. Git Basics : Git Repository (Repo) 3 3
  • 22. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Git Basics • Git Repository • Commands • Git and Github • Git GUI • Git Branching
  • 23. Git Basics : Commands • Create a empty directory. • Create git repository. $ mkdir hellogit $ cd hellogit $ git init
  • 24. Git Basics : Commands • Create content • Show content $ touch data.txt $ echo “content” > data.txt $ echo “concat” >> data.txt $ cat data.txt
  • 25. Git Basics : Commands • See the current status. $ git status
  • 26. Git Basics : Commands • Add file to the staging area. $ git add data.txt $ git add .
  • 27. Git Basics : Commands • Remove file to the staging area. $ git rm data.txt
  • 28. Git Basics : Commands • Commit file to the local repository. $ git commit –m “Your commit msg”
  • 29. Git Basics : Commands • Show git log for the change. $ git log
  • 30. Outline • About Version Control • Hello, Git! • What is Git? • Getting Started • Git Basics • Git and Github • Git GUI • Git Branching
  • 32. • Make a new repository on GitHub. Github : Git and Github
  • 33. • Make a new repository on GitHub. Github : Git and Github “Your Repo Name”
  • 34. • Creates a remote named “origin” pointing at your github repo. Github : Git and Github $ git remote add origin “URL” “ URL ”
  • 35. • Push your commit. Github : Git and Github $ git push origin master
  • 36. • Push your commit. Github : Git and Github $ git push origin master
  • 37. • Push your commit. Github : Git and Github
  • 38. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching
  • 39. Git GUI • Graphical Git Client for Linux • Git-cola • Gitg • SmartGit • Giggle • Git Gui • qGit • gitk
  • 41. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching • Data Structures • About Branching • Merge Branches
  • 42. Git Branching : Data Structures 紀錄檔案內容 檔案目錄 紀錄訊息
  • 43. Git Branching : Data Structures • Single commit repository data.
  • 44. Git Branching : Data Structures • Git object data for multiple commits.
  • 45. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching • Data Structures • About Branching • Merge Branches
  • 46. Git Branching: About Branching • Create a new branch. $ git branch testing “ Your branch name”
  • 47. Git Branching: About Branching • Switch to an existing branch. $ git checkout testing “ Your branch name”
  • 48. Git Branching: About Branching • Switch to an existing branch. $ git checkout testing “ Your branch name”
  • 49. Outline • About Version Control • Hello, Git! • Git GUI • Git Branching • Data Structures • About Branching • Merge Branches
  • 50. Git Branching: Merge Branches $ git checkout –b iss53 “ Your branch name”
  • 51. Git Branching: Merge Branches index.html $ vim index.html $ git add $ git commit –m “issue 53”
  • 52. index.html index.html $ git checkout master $ git checkout –b hotfix $ vim index.html $ vim add $ git commit –m “hotfix”
  • 53. index.html index.html $ git checkout master $ git merge hotfix $ git branch –d hotfix
  • 54. $ git checkout master $ git merge iss53
  • 55. master and iss53 : no common ancestors
  • 56. master and iss53 : no common ancestors
  • 57. Reference • Git Documentation • http://git-scm.com/documentation • 版本控制系統Git 精要| ihower 的Git 教室 • http://ihower.tw/git/remote.html • 寫給大家的Git 教學 • http://www.slideshare.net/littlebtc/git-5528339
  • 58. Q & A 愚人節快樂 :)