SlideShare a Scribd company logo
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 slides
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 :)
Ad

More Related Content

What's hot (20)

Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
Jason Byrne
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Houari ZEGAI
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
Aderemi 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 Git
E Carter
 
Github
GithubGithub
Github
MeetPatel710
 
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
Rueful Robin
 
Git basics
Git basicsGit basics
Git basics
Ashwin Date
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
Luigi De Russis
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
Shilu Shrestha
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone use
Ikuru Kanuma
 
Git - The Incomplete Introduction
Git - The Incomplete IntroductionGit - The Incomplete Introduction
Git - The Incomplete Introduction
rschwietzke
 
沒有 GUI 的 Git
沒有 GUI 的 Git沒有 GUI 的 Git
沒有 GUI 的 Git
Chia Wei Tsai
 
Github Case Study By Amil Ali
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil Ali
AmilAli1
 
Git introduction workshop for scientists
Git introduction workshop for scientists Git introduction workshop for scientists
Git introduction workshop for scientists
Steven Hamblin
 
Git basics
Git basicsGit basics
Git basics
Amit Sawhney
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Lukas Fittl
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
mwrather
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
Jason Byrne
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Houari ZEGAI
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
Aderemi 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 Git
E 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 overview
Rueful Robin
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
Luigi De Russis
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone use
Ikuru Kanuma
 
Git - The Incomplete Introduction
Git - The Incomplete IntroductionGit - The Incomplete Introduction
Git - The Incomplete Introduction
rschwietzke
 
Github Case Study By Amil Ali
Github Case Study By Amil AliGithub Case Study By Amil Ali
Github Case Study By Amil Ali
AmilAli1
 
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 Git
Lukas Fittl
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
mwrather
 

Viewers also liked (10)

235621493 concom-cases
235621493 concom-cases235621493 concom-cases
235621493 concom-cases
homeworkping3
 
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-cases
homeworkping3
 
236113486 labor-cases
236113486 labor-cases236113486 labor-cases
236113486 labor-cases
homeworkping3
 
Importaciones y exportaciones en mexico
Importaciones y exportaciones en mexicoImportaciones y exportaciones en mexico
Importaciones y exportaciones en mexico
abraham romero
 
Складазлучаныя сказы
Складазлучаныя сказыСкладазлучаныя сказы
Складазлучаныя сказы
Sergey Miranovich
 
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
Oleksiy Goryayinov
 
Vestige success Plan
Vestige success PlanVestige success Plan
Vestige success Plan
Mohinder Singh
 
Plan de negocios agroindustriales
Plan  de negocios agroindustrialesPlan  de negocios agroindustriales
Plan de negocios agroindustriales
Carlos Loma
 
Romarias
RomariasRomarias
Romarias
Sonia a
 
235621493 concom-cases
235621493 concom-cases235621493 concom-cases
235621493 concom-cases
homeworkping3
 
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-cases
homeworkping3
 
236113486 labor-cases
236113486 labor-cases236113486 labor-cases
236113486 labor-cases
homeworkping3
 
Importaciones y exportaciones en mexico
Importaciones y exportaciones en mexicoImportaciones y exportaciones en mexico
Importaciones y exportaciones en mexico
abraham romero
 
Складазлучаныя сказы
Складазлучаныя сказыСкладазлучаныя сказы
Складазлучаныя сказы
Sergey Miranovich
 
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
ТПЛМ 1054 Взаємодія логістики з виробництвом, фінансами, кадрами. О.М.Горяїно...
Oleksiy Goryayinov
 
Plan de negocios agroindustriales
Plan  de negocios agroindustrialesPlan  de negocios agroindustriales
Plan de negocios agroindustriales
Carlos Loma
 
Romarias
RomariasRomarias
Romarias
Sonia a
 
Ad

Similar to Git slides (20)

Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
Arashdeepkaur16
 
Git and github
Git and githubGit and github
Git and github
Teodora Ahkozidou
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
GDSC UofT Mississauga
 
Learning git
Learning gitLearning git
Learning git
Sid Anand
 
Git and Github
Git and GithubGit and Github
Git and Github
Teodora Ahkozidou
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
Nguyen Van Hung
 
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
Ashok Kumar Satuluri
 
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 - Workflow
Tahsin Abrar
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
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
HuthaifaAlmaqrami1
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
Wildan 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 Article
PRIYATHAMDARISI
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
themystic_ca
 
Git
GitGit
Git
Vijay Kani
 
GIT-FirstPart.ppt
GIT-FirstPart.pptGIT-FirstPart.ppt
GIT-FirstPart.ppt
ssusered2ec2
 
16 Git
16 Git16 Git
16 Git
Hadley Wickham
 
Git
GitGit
Git
Terry Wang
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Learning git
Learning gitLearning git
Learning git
Sid 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 - Workflow
Tahsin Abrar
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
DSC GVP
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
Wildan 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 Article
PRIYATHAMDARISI
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
themystic_ca
 
Git 入门与实践
Git 入门与实践Git 入门与实践
Git 入门与实践
Terry Wang
 
Ad

More from Nguyen Van Hung (17)

Su dung linux shell
Su dung linux shellSu dung linux shell
Su dung linux shell
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_iptables
Nguyen Van Hung
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
Nguyen 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à mvc
Nguyen 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 nhat
Nguyen 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 nhat
Nguyen 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 vn
Nguyen 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 vn
Nguyen Van Hung
 
Northwind products
Northwind productsNorthwind products
Northwind products
Nguyen 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] - copy
Nguyen 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ình
Nguyen 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ỗ1
Nguyen Van Hung
 
Khoahoctunhien.net mang1chieu
Khoahoctunhien.net mang1chieuKhoahoctunhien.net mang1chieu
Khoahoctunhien.net mang1chieu
Nguyen Van Hung
 
Doi xung mang mot chieu
Doi xung mang mot chieuDoi xung mang mot chieu
Doi xung mang mot chieu
Nguyen 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 iv
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_iptables
Nguyen 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à mvc
Nguyen 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 nhat
Nguyen 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 nhat
Nguyen 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 vn
Nguyen 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 vn
Nguyen 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] - copy
Nguyen 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ình
Nguyen 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ỗ1
Nguyen Van Hung
 
Khoahoctunhien.net mang1chieu
Khoahoctunhien.net mang1chieuKhoahoctunhien.net mang1chieu
Khoahoctunhien.net mang1chieu
Nguyen 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 iv
Nguyen Van Hung
 

Recently uploaded (20)

Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Introduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe EngineeringIntroduction to Vibe Coding and Vibe Engineering
Introduction to Vibe Coding and Vibe Engineering
Damian T. Gordon
 

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
  • 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 “ [email protected]””  Create a repo  “git init”  Clone a repo  “git clone git://git.kernel.org/scm/git/git.git”  git clone ssh://[email protected]/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 :)