SlideShare a Scribd company logo
1 of 25
GIT tutorial
Wing Research Group
Introduction
 Learn why and how GIT aids software
development
 The outcome of this tutorial:
 Understand the design and phylosophy of GIT
 Be able to use GIT for everyday work
Agenda
 GIT background
 GIT design objectives
 Everyday work with GIT
 QA
Overview
 Collaboration is ubiquitous in software
development. Consequently, you see CVS,
SVN, Mercurial, TLA, Mecurial and GIT.
 How such a SCM can help many people to
work together effectively?
Terminology
 Repository
 Pull / Push / Checkout
 Branch
 Merge
 Conflict
 Commit
 Revert
GIT background
 Developed by Linus Torvald
 Purpose: to facilitate Linux kernel
development
 Consider CVS/SVN as the evil
Git design objectives
 Distributed
 No central repo
 Everyone is on her own island
 Write access class VS. Network of trust
 Performance
 Branching and merge is cheap
 Diff the whole kernel tree in less than 1 second
 Store the KDE tree in less than 2GB while SVN
takes 8GB
Git design objectives
 Reliability
 File corruption, RAM corruption, Macilious
users
 GIT tracks the content of the whole repo, not
single file, not only filenames
 GIT use SHA1 for data integrity: file, commit,
repo...
 Consequently:
 May not check in a single file
 May not check out a single file
 Break a big project to sub projects smartly :)
Everyday tasks with GIT
 GIT has many routines:
 “git merge”
 “git pull”
 “git push”
 “gitk”
 “git init”
 “git config”
 GIT man page
 “man git-merge”
Everyday tasks with GIT
 Introduce yourself to GIT
 “git config –global user.name “Trung””
 “git config –global user.email “
u0407784@nus.edu.sg””
 Create a repo
 “git init”
 Clone a repo
 “git clone git://git.kernel.org/scm/git/git.git”
 git clone
ssh://trunglt@aye.comp.nus.edu.sg/home/min/fore
cite/
Everyday tasks with GIT
 Lean a bit about GIT concepts:
 Repo: your local repo and remote repos
 Reference in history: either commit or merge
 Branch: “master” is the default branch name. Do
not give name such as test1, test2... but test_login,
rel_iteration1
 SHA1
 Tag: a friendly name for a commit (version 1.0 vs
e74g64a21...)
 Head: you see that branch is a series of commits.
A branch name also means the latest commit on
that branch
Everyday tasks with GIT
 HEAD: the commit that you are working on
 HEAD^, HEAD^^, HEAD~3 = HEAD^^^,
 HEAD^1, HEAD^2
Everyday tasks with GIT
 Create a branch:
 “git branch <name>”
 “git branch <name> <commit-id>”
 Delete a branch:
 “git branch -d <name>”
 List branch:
 “git branch”
 “git branch -r” //remote branch
 Jump to a commit:
 “git checkout <commit-id>”
 “git checkout -b <name> <commit-id>”
Everyday tasks with GIT
 Give remote repo a nicer name:
 “git remote add min
ssh://<username>@aye.comp.nus.edu.sg/home/mi
n/parcite”
 Fetch changes from Min:
 “get fetch min”
 Merge with the master branch of Min's repo:
 “get merge min/master”
 Or in one shot: git pull min
Everyday tasks with GIT
 View SHA1 of a commit:
 Git rev-list HEAD^..HEAD
 View logs:
 “git log”
 “git log HEAD~4..HEAD”
 “git log –pretty=oneline v1.0..v2.0 | wc-l
 git log --raw -r --abbrev=40 –pretty=oneline
origin..HEAD
 git archive --format=tar --prefix=project/ HEAD |
gzip >latest.tar.gz
 “git blame <filename>”
Everyday tasks with GIT
 Git commit and merge:
 Git has its own index database
 When you edit your repo, there are 3 things:
 HEAD: the reference in history from that you are editing
 Cached: whatever you have just added and run git add
 The remaining files that you have not ask git to keep
track
Everyday tasks with GIT
 Make a commit:
 After you edit some files,
 look at the output of “git status”
 ask GIT to keep track new files: “git add .”
 Create new files
 “git diff –cached”
 “git add .”
 “git diff HEAD”
 “git commit”
Everyday tasks with GIT
 Git merge:
 “git pull min” OR (“git fetch min” then “git merge
min”)
 Conflicts
 $ git show :1:file.txt # the file in a common ancestor of
both branches
 $ git show :2:file.txt # the version from HEAD, but
including any
 # nonconflicting changes from
MERGE_HEAD
 $ git show :3:file.txt # the version from MERGE_HEAD,
but including any
 # nonconflicting changes from HEAD.
 Resolve the conflicts / reset and ask others to help
Everyday tasks with GIT
 Reset the conflicted merge: use git-reset
 “git reset –mixed <commit-id>
 Reset the index database to the moment before
merging
 “git reset –hard <commit-id>
 Reset the index database and the working data
 “git reset –soft <commit-id>
 You made a commit and also made some typo
mistake. This commands help us fix those errors
without touching the working data and index
database
Everyday tasks with GIT
 “git reset” help you to revert the most recent
commit only
 Revert older commit by hiding is bad
 Use “git revert” to introduce a patch to revert
the merge/commit done.
 This is left as an exercise
Everyday tasks with GIT
 Last thing: how to ignore files in a repo:
 Use .gitignore: list files that you want to ignore
 Put .gitignore in the directory containing the files
 Example: Ruby on Rails project
 Example: C/C++ project
Everyday tasks with GIT
 Quality Assurance? How Linux developer keep
track of bugs:
 “git bisect”: binary search for a bug in a series
of commits:
 git bisect start
 git bisect good v2.6.17
 git bisect bad v2.6.18
Question and Answer
 Question and Answer :)
Summary
 Git is a great tools for collaboration
 New paradigm in SCM
 Difficult to master, so learn it through
everyday usage
 Can always post questions to forum/admin
group or :) Trung :)

More Related Content

What's hot

Version Control & Git
Version Control & GitVersion Control & Git
Version Control & GitJason Byrne
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and GithubHouari ZEGAI
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and githubAderemi Dadepo
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Simplilearn
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitE Carter
 
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
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with GitLuigi De Russis
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone useIkuru Kanuma
 
Git - The Incomplete Introduction
Git - The Incomplete IntroductionGit - The Incomplete Introduction
Git - The Incomplete Introductionrschwietzke
 
Github Case Study By Amil Ali
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil AliAmilAli1
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists Steven Hamblin
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015mwrather
 

What's hot (20)

Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
Git Tutorial For Beginners | What is Git and GitHub? | DevOps Tools | DevOps ...
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Github
GithubGithub
Github
 
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 basics
Git basicsGit basics
Git basics
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone use
 
Git - The Incomplete Introduction
Git - The Incomplete IntroductionGit - The Incomplete Introduction
Git - The Incomplete Introduction
 
沒有 GUI 的 Git
沒有 GUI 的 Git沒有 GUI 的 Git
沒有 GUI 的 Git
 
Github Case Study By Amil Ali
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil Ali
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists
 
Git basics
Git basicsGit basics
Git basics
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
 

Viewers also liked

235621493 concom-cases
235621493 concom-cases235621493 concom-cases
235621493 concom-caseshomeworkping3
 
Reglamento de la Ley que fomenta la liquidez e integración del Mercado de Val...
Reglamento de la Ley que fomenta la liquidez e integración del Mercado de Val...Reglamento de la Ley que fomenta la liquidez e integración del Mercado de Val...
Reglamento de la Ley que fomenta la liquidez e integración del Mercado de Val...Yanira Becerra
 
236279141 injunction-cases
236279141 injunction-cases236279141 injunction-cases
236279141 injunction-caseshomeworkping3
 
236113486 labor-cases
236113486 labor-cases236113486 labor-cases
236113486 labor-caseshomeworkping3
 
Importaciones y exportaciones en mexico
Importaciones y exportaciones en mexicoImportaciones y exportaciones en mexico
Importaciones y exportaciones en mexicoabraham romero
 
Складазлучаныя сказы
Складазлучаныя сказыСкладазлучаныя сказы
Складазлучаныя сказыSergey Miranovich
 
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...Oleksiy Goryayinov
 
Plan de negocios agroindustriales
Plan  de negocios agroindustrialesPlan  de negocios agroindustriales
Plan de negocios agroindustrialesCarlos Loma
 
Romarias
RomariasRomarias
RomariasSonia a
 

Viewers also liked (10)

235621493 concom-cases
235621493 concom-cases235621493 concom-cases
235621493 concom-cases
 
Reglamento de la Ley que fomenta la liquidez e integración del Mercado de Val...
Reglamento de la Ley que fomenta la liquidez e integración del Mercado de Val...Reglamento de la Ley que fomenta la liquidez e integración del Mercado de Val...
Reglamento de la Ley que fomenta la liquidez e integración del Mercado de Val...
 
236279141 injunction-cases
236279141 injunction-cases236279141 injunction-cases
236279141 injunction-cases
 
236113486 labor-cases
236113486 labor-cases236113486 labor-cases
236113486 labor-cases
 
Importaciones y exportaciones en mexico
Importaciones y exportaciones en mexicoImportaciones y exportaciones en mexico
Importaciones y exportaciones en mexico
 
Складазлучаныя сказы
Складазлучаныя сказыСкладазлучаныя сказы
Складазлучаныя сказы
 
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
 
Vestige success Plan
Vestige success PlanVestige success Plan
Vestige success Plan
 
Plan de negocios agroindustriales
Plan  de negocios agroindustrialesPlan  de negocios agroindustriales
Plan de negocios agroindustriales
 
Romarias
RomariasRomarias
Romarias
 

Similar to Git slides

Learning git
Learning gitLearning git
Learning gitSid Anand
 
Git is a distributed version control system .
Git is a distributed version control system .Git is a distributed version control system .
Git is a distributed version control system .HELLOWorld889594
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - WorkflowTahsin Abrar
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubDSC GVP
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting StartedWildan Maulana
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticlePRIYATHAMDARISI
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践Terry Wang
 

Similar to Git slides (20)

Git introduction
Git introductionGit introduction
Git introduction
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
 
Git and github
Git and githubGit and github
Git and github
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
 
Learning git
Learning gitLearning git
Learning git
 
Git and Github
Git and GithubGit and Github
Git and Github
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
 
Git is a distributed version control system .
Git is a distributed version control system .Git is a distributed version control system .
Git is a distributed version control system .
 
Mastering git - Workflow
Mastering git - WorkflowMastering git - Workflow
Mastering git - Workflow
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
Git
GitGit
Git
 
GIT-FirstPart.ppt
GIT-FirstPart.pptGIT-FirstPart.ppt
GIT-FirstPart.ppt
 
16 Git
16 Git16 Git
16 Git
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
 
Git
GitGit
Git
 

More from Nguyen Van Hung

Cai dat va_cau_hinh_iptables
Cai dat va_cau_hinh_iptablesCai dat va_cau_hinh_iptables
Cai dat va_cau_hinh_iptablesNguyen Van Hung
 
So sánh asp.net và mvc
So sánh asp.net và mvcSo sánh asp.net và mvc
So sánh asp.net và mvcNguyen Van Hung
 
Cong thuc sinh hoc 12 day du nhat
Cong thuc sinh hoc 12 day du nhatCong thuc sinh hoc 12 day du nhat
Cong thuc sinh hoc 12 day du nhatNguyen Van Hung
 
Cong thuc sinh hoc 12 day du nhat
Cong thuc sinh hoc 12 day du nhatCong thuc sinh hoc 12 day du nhat
Cong thuc sinh hoc 12 day du nhatNguyen Van Hung
 
Asp net mvc3 music store egroups vn
Asp net mvc3 music store   egroups vnAsp net mvc3 music store   egroups vn
Asp net mvc3 music store egroups vnNguyen Van Hung
 
Asp.net mvc 3 (c#) (9 tutorials) egroups vn
Asp.net mvc 3 (c#) (9 tutorials)   egroups vnAsp.net mvc 3 (c#) (9 tutorials)   egroups vn
Asp.net mvc 3 (c#) (9 tutorials) egroups vnNguyen Van Hung
 
Cau truc dl_va_giai_thuat_bai1[1] - copy
Cau truc dl_va_giai_thuat_bai1[1] - copyCau truc dl_va_giai_thuat_bai1[1] - copy
Cau truc dl_va_giai_thuat_bai1[1] - copyNguyen Van Hung
 
Thạch quyển và các dạng địa hình
Thạch quyển và các dạng địa hìnhThạch quyển và các dạng địa hình
Thạch quyển và các dạng địa hìnhNguyen Van Hung
 
Bài tập về chuẩn hóa chuỗ1
Bài tập về chuẩn hóa chuỗ1Bài tập về chuẩn hóa chuỗ1
Bài tập về chuẩn hóa chuỗ1Nguyen Van Hung
 
Khoahoctunhien.net mang1chieu
Khoahoctunhien.net mang1chieuKhoahoctunhien.net mang1chieu
Khoahoctunhien.net mang1chieuNguyen Van Hung
 
De cuong tu tuong hcm khoa iv
De cuong tu tuong hcm  khoa ivDe cuong tu tuong hcm  khoa iv
De cuong tu tuong hcm khoa ivNguyen Van Hung
 

More from Nguyen Van Hung (17)

Su dung linux shell
Su dung linux shellSu dung linux shell
Su dung linux shell
 
Cai dat va_cau_hinh_iptables
Cai dat va_cau_hinh_iptablesCai dat va_cau_hinh_iptables
Cai dat va_cau_hinh_iptables
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
So sánh asp.net và mvc
So sánh asp.net và mvcSo sánh asp.net và mvc
So sánh asp.net và mvc
 
Cong thuc sinh hoc 12 day du nhat
Cong thuc sinh hoc 12 day du nhatCong thuc sinh hoc 12 day du nhat
Cong thuc sinh hoc 12 day du nhat
 
Cong thuc sinh hoc 12 day du nhat
Cong thuc sinh hoc 12 day du nhatCong thuc sinh hoc 12 day du nhat
Cong thuc sinh hoc 12 day du nhat
 
Asp net mvc3 music store egroups vn
Asp net mvc3 music store   egroups vnAsp net mvc3 music store   egroups vn
Asp net mvc3 music store egroups vn
 
Asp.net mvc 3 (c#) (9 tutorials) egroups vn
Asp.net mvc 3 (c#) (9 tutorials)   egroups vnAsp.net mvc 3 (c#) (9 tutorials)   egroups vn
Asp.net mvc 3 (c#) (9 tutorials) egroups vn
 
Northwind products
Northwind productsNorthwind products
Northwind products
 
Cau truc dl_va_giai_thuat_bai1[1] - copy
Cau truc dl_va_giai_thuat_bai1[1] - copyCau truc dl_va_giai_thuat_bai1[1] - copy
Cau truc dl_va_giai_thuat_bai1[1] - copy
 
Bao cao
Bao caoBao cao
Bao cao
 
Thạch quyển và các dạng địa hình
Thạch quyển và các dạng địa hìnhThạch quyển và các dạng địa hình
Thạch quyển và các dạng địa hình
 
Bài tập về chuẩn hóa chuỗ1
Bài tập về chuẩn hóa chuỗ1Bài tập về chuẩn hóa chuỗ1
Bài tập về chuẩn hóa chuỗ1
 
Khoahoctunhien.net mang1chieu
Khoahoctunhien.net mang1chieuKhoahoctunhien.net mang1chieu
Khoahoctunhien.net mang1chieu
 
Doi xung mang mot chieu
Doi xung mang mot chieuDoi xung mang mot chieu
Doi xung mang mot chieu
 
Gtrinh oop[1]
Gtrinh oop[1]Gtrinh oop[1]
Gtrinh oop[1]
 
De cuong tu tuong hcm khoa iv
De cuong tu tuong hcm  khoa ivDe cuong tu tuong hcm  khoa iv
De cuong tu tuong hcm khoa iv
 

Recently uploaded

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 

Recently uploaded (20)

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 

Git slides

  • 2. Introduction  Learn why and how GIT aids software development  The outcome of this tutorial:  Understand the design and phylosophy of GIT  Be able to use GIT for everyday work
  • 3. Agenda  GIT background  GIT design objectives  Everyday work with GIT  QA
  • 4. Overview  Collaboration is ubiquitous in software development. Consequently, you see CVS, SVN, Mercurial, TLA, Mecurial and GIT.  How such a SCM can help many people to work together effectively?
  • 5. Terminology  Repository  Pull / Push / Checkout  Branch  Merge  Conflict  Commit  Revert
  • 6.
  • 7. GIT background  Developed by Linus Torvald  Purpose: to facilitate Linux kernel development  Consider CVS/SVN as the evil
  • 8. Git design objectives  Distributed  No central repo  Everyone is on her own island  Write access class VS. Network of trust  Performance  Branching and merge is cheap  Diff the whole kernel tree in less than 1 second  Store the KDE tree in less than 2GB while SVN takes 8GB
  • 9. Git design objectives  Reliability  File corruption, RAM corruption, Macilious users  GIT tracks the content of the whole repo, not single file, not only filenames  GIT use SHA1 for data integrity: file, commit, repo...  Consequently:  May not check in a single file  May not check out a single file  Break a big project to sub projects smartly :)
  • 10. Everyday tasks with GIT  GIT has many routines:  “git merge”  “git pull”  “git push”  “gitk”  “git init”  “git config”  GIT man page  “man git-merge”
  • 11. Everyday tasks with GIT  Introduce yourself to GIT  “git config –global user.name “Trung””  “git config –global user.email “ u0407784@nus.edu.sg””  Create a repo  “git init”  Clone a repo  “git clone git://git.kernel.org/scm/git/git.git”  git clone ssh://trunglt@aye.comp.nus.edu.sg/home/min/fore cite/
  • 12. Everyday tasks with GIT  Lean a bit about GIT concepts:  Repo: your local repo and remote repos  Reference in history: either commit or merge  Branch: “master” is the default branch name. Do not give name such as test1, test2... but test_login, rel_iteration1  SHA1  Tag: a friendly name for a commit (version 1.0 vs e74g64a21...)  Head: you see that branch is a series of commits. A branch name also means the latest commit on that branch
  • 13. Everyday tasks with GIT  HEAD: the commit that you are working on  HEAD^, HEAD^^, HEAD~3 = HEAD^^^,  HEAD^1, HEAD^2
  • 14. Everyday tasks with GIT  Create a branch:  “git branch <name>”  “git branch <name> <commit-id>”  Delete a branch:  “git branch -d <name>”  List branch:  “git branch”  “git branch -r” //remote branch  Jump to a commit:  “git checkout <commit-id>”  “git checkout -b <name> <commit-id>”
  • 15. Everyday tasks with GIT  Give remote repo a nicer name:  “git remote add min ssh://<username>@aye.comp.nus.edu.sg/home/mi n/parcite”  Fetch changes from Min:  “get fetch min”  Merge with the master branch of Min's repo:  “get merge min/master”  Or in one shot: git pull min
  • 16. Everyday tasks with GIT  View SHA1 of a commit:  Git rev-list HEAD^..HEAD  View logs:  “git log”  “git log HEAD~4..HEAD”  “git log –pretty=oneline v1.0..v2.0 | wc-l  git log --raw -r --abbrev=40 –pretty=oneline origin..HEAD  git archive --format=tar --prefix=project/ HEAD | gzip >latest.tar.gz  “git blame <filename>”
  • 17. Everyday tasks with GIT  Git commit and merge:  Git has its own index database  When you edit your repo, there are 3 things:  HEAD: the reference in history from that you are editing  Cached: whatever you have just added and run git add  The remaining files that you have not ask git to keep track
  • 18. Everyday tasks with GIT  Make a commit:  After you edit some files,  look at the output of “git status”  ask GIT to keep track new files: “git add .”  Create new files  “git diff –cached”  “git add .”  “git diff HEAD”  “git commit”
  • 19. Everyday tasks with GIT  Git merge:  “git pull min” OR (“git fetch min” then “git merge min”)  Conflicts  $ git show :1:file.txt # the file in a common ancestor of both branches  $ git show :2:file.txt # the version from HEAD, but including any  # nonconflicting changes from MERGE_HEAD  $ git show :3:file.txt # the version from MERGE_HEAD, but including any  # nonconflicting changes from HEAD.  Resolve the conflicts / reset and ask others to help
  • 20. Everyday tasks with GIT  Reset the conflicted merge: use git-reset  “git reset –mixed <commit-id>  Reset the index database to the moment before merging  “git reset –hard <commit-id>  Reset the index database and the working data  “git reset –soft <commit-id>  You made a commit and also made some typo mistake. This commands help us fix those errors without touching the working data and index database
  • 21. Everyday tasks with GIT  “git reset” help you to revert the most recent commit only  Revert older commit by hiding is bad  Use “git revert” to introduce a patch to revert the merge/commit done.  This is left as an exercise
  • 22. Everyday tasks with GIT  Last thing: how to ignore files in a repo:  Use .gitignore: list files that you want to ignore  Put .gitignore in the directory containing the files  Example: Ruby on Rails project  Example: C/C++ project
  • 23. Everyday tasks with GIT  Quality Assurance? How Linux developer keep track of bugs:  “git bisect”: binary search for a bug in a series of commits:  git bisect start  git bisect good v2.6.17  git bisect bad v2.6.18
  • 24. Question and Answer  Question and Answer :)
  • 25. Summary  Git is a great tools for collaboration  New paradigm in SCM  Difficult to master, so learn it through everyday usage  Can always post questions to forum/admin group or :) Trung :)