SlideShare una empresa de Scribd logo
1 de 20
Git
The fast version control system
Version Control System
• Allows to track changes to files
• Provides repository of changes
• Consists working directory / current state
• VCS can be:
• Centralized (Ex: SVN, CVS)
• Server: single database
• Clent: working directory and state.
• Decentralized(Ex: BitKeeper, Mercurial, Git)
What is Git?
• free & open source
• distributed version control system
• Anyone can be the server
• Repository coupled with working directory
• Complete history
• Disconnected operation
• No single point of failure
• Designed to be fast and efficient for small and very
large size projects
Git history
• 2002
• Linus Torvalds decided to use BitKeeper for tracking
Linux kernel development
• Linux development scales better
• 2005
• BitMover dropped free license
• Linus writes his own VCS, Git
Getting started with Git
• yum install git-core
• git clone --help
• git config --global user.name
‘Keshavaprasad B S’
• git config --global user.email
kbsbng@gmail.com
Getting started with Git
• Creating new git repo:
• git init
• git add
• git commit
• Cloning from existing repo:
• man git-clone
Git config
• Types
• $(prefix)/etc/gitconfig --> system
• ~/.gitconfig --> global
• .git/config --> local
• Aliases
Concept of working
directory, index and repository
• git add -> adds stuff to index
• git commit -> commits stuff from
index to repository
• git diff -> diff between working tree
and index
• git diff --cached -> diff between
HEAD and repository
Concept of working
directory, index and repository
• git fetch-> fetch the code from
remote repo to local
• git pull -> pulls code from remote to
local and w.d.
• git checkout -> checkout code from
local repo to w.d.
Git object model
• All the information needed to represent the history of a
project is stored in files referenced by a 40-digit SHA1
hash.
• Each object consists of type, size and contents.
• 4 types of objects
• Blob – stores files data (generally a file)
• Tree – consists bunch of other trees or blobs (files and
subdirectories)
• Commit – points to a single tree. Contains meta of
author, timestamp, pointer to prev. commit etc.
• Tag – Marks a specific commit
Git object model
• Git show <sha>
gitk and git log
• Install gitk
• git log --pretty=oneline
• git log --pretty=format:'%h : %s' --topo-order –graph
• git log --no-merges
• git log --stat
Git branches
• git clone
git@github.com:kbsbng/try_git.git
• git branch hack-1
• Make changes and commit to branch and master
• git rebase master hack-1
• git merge hack-1
Git merge/rebase
1. git checkout -b
mywork origin
3a. git pull
3b. git pull --rebase
Git tags
• Lighweight tags (branch that never moves)
• git tag stable-1 <commit>
• Tag Objects
• Can include comments / signature
• git tag –a stable-1 <commit>
Stashes
• git stash save “WIP for foo feature”
• git stash apply
• git stash list
Some tips
• Git grep can be used search through previous
versions of a project without checking them out.
• master@{yesterday} refers to where the master
branch was yesterday.
Git vs svn
• Cheap local branching
• Everything is Local
• Fast
• Git is small
• Provides staging area
• Distributed
• Any workflow
• Github
References
• http://book.git-scm.com/
• http://whygitisbetterthanx.com
Thank you

Más contenido relacionado

La actualidad más candente

Oslo Vancouver Onboarding
Oslo Vancouver OnboardingOslo Vancouver Onboarding
Oslo Vancouver OnboardingBen Nemec
 
Globus Connect Server v5 Q&A Briefing
Globus Connect Server v5 Q&A BriefingGlobus Connect Server v5 Q&A Briefing
Globus Connect Server v5 Q&A BriefingGlobus
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone useIkuru Kanuma
 
Managing replication of PostgreSQL, Simon Riggs
Managing replication of PostgreSQL, Simon RiggsManaging replication of PostgreSQL, Simon Riggs
Managing replication of PostgreSQL, Simon RiggsFuenteovejuna
 
Contemporary source control for pharo
Contemporary source control for pharoContemporary source control for pharo
Contemporary source control for pharoESUG
 
Netflix Titus WASP October 2017
Netflix Titus WASP October 2017Netflix Titus WASP October 2017
Netflix Titus WASP October 2017Andrew Leung
 
Git & Github @ ROSEdu CDL
Git & Github @ ROSEdu CDLGit & Github @ ROSEdu CDL
Git & Github @ ROSEdu CDLAlex Palcuie
 
Approaches for duplicating Kubernetes Storage with Gluster
Approaches for duplicating Kubernetes Storage with GlusterApproaches for duplicating Kubernetes Storage with Gluster
Approaches for duplicating Kubernetes Storage with Glustermountpoint.io
 
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
 
News from Git in Java Land
News from Git in Java LandNews from Git in Java Land
News from Git in Java Landmsohn
 
Last Month in PHP - December 2015
Last Month in PHP - December 2015Last Month in PHP - December 2015
Last Month in PHP - December 2015Eric Poe
 
Archivematica Community Profile: University of Houston by Bethany Scott
Archivematica Community Profile: University of Houston by Bethany ScottArchivematica Community Profile: University of Houston by Bethany Scott
Archivematica Community Profile: University of Houston by Bethany ScottArtefactual Systems - Archivematica
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using GitYan Vugenfirer
 

La actualidad más candente (20)

Git para novatos
Git para novatosGit para novatos
Git para novatos
 
Oslo Vancouver Onboarding
Oslo Vancouver OnboardingOslo Vancouver Onboarding
Oslo Vancouver Onboarding
 
Intro to git
Intro to gitIntro to git
Intro to git
 
Globus Connect Server v5 Q&A Briefing
Globus Connect Server v5 Q&A BriefingGlobus Connect Server v5 Q&A Briefing
Globus Connect Server v5 Q&A Briefing
 
Do You Get Git?
Do You Get Git? Do You Get Git?
Do You Get Git?
 
Git for standalone use
Git for standalone useGit for standalone use
Git for standalone use
 
Managing replication of PostgreSQL, Simon Riggs
Managing replication of PostgreSQL, Simon RiggsManaging replication of PostgreSQL, Simon Riggs
Managing replication of PostgreSQL, Simon Riggs
 
Git.odp 0
Git.odp 0Git.odp 0
Git.odp 0
 
Contemporary source control for pharo
Contemporary source control for pharoContemporary source control for pharo
Contemporary source control for pharo
 
Netflix Titus WASP October 2017
Netflix Titus WASP October 2017Netflix Titus WASP October 2017
Netflix Titus WASP October 2017
 
Logstash
LogstashLogstash
Logstash
 
Git & Github @ ROSEdu CDL
Git & Github @ ROSEdu CDLGit & Github @ ROSEdu CDL
Git & Github @ ROSEdu CDL
 
OpenStack Marketing Meeting Oct 2
OpenStack Marketing Meeting Oct 2OpenStack Marketing Meeting Oct 2
OpenStack Marketing Meeting Oct 2
 
Approaches for duplicating Kubernetes Storage with Gluster
Approaches for duplicating Kubernetes Storage with GlusterApproaches for duplicating Kubernetes Storage with Gluster
Approaches for duplicating Kubernetes Storage with Gluster
 
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
 
News from Git in Java Land
News from Git in Java LandNews from Git in Java Land
News from Git in Java Land
 
Last Month in PHP - December 2015
Last Month in PHP - December 2015Last Month in PHP - December 2015
Last Month in PHP - December 2015
 
6.0 is coming
6.0 is coming6.0 is coming
6.0 is coming
 
Archivematica Community Profile: University of Houston by Bethany Scott
Archivematica Community Profile: University of Houston by Bethany ScottArchivematica Community Profile: University of Houston by Bethany Scott
Archivematica Community Profile: University of Houston by Bethany Scott
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using Git
 

Similar a Git

Git.From thorns to the stars
Git.From thorns to the starsGit.From thorns to the stars
Git.From thorns to the starsStrannik_2013
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network EngineersJoel W. King
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Gitatishgoswami
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIsTim Osborn
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Ahmed El-Arabawy
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptxtnscharishma
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
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
 
Sprints-Day 6.pptx
Sprints-Day 6.pptxSprints-Day 6.pptx
Sprints-Day 6.pptxRupaRaj6
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubKim Moir
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
 
Source Control Using Git
Source Control Using Git Source Control Using Git
Source Control Using Git Chris Mylonas
 

Similar a Git (20)

Git.From thorns to the stars
Git.From thorns to the starsGit.From thorns to the stars
Git.From thorns to the stars
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git and github
Git and githubGit and github
Git and github
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Git
GitGit
Git
 
git and github-1.pptx
git and github-1.pptxgit and github-1.pptx
git and github-1.pptx
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
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 .
 
Sprints-Day 6.pptx
Sprints-Day 6.pptxSprints-Day 6.pptx
Sprints-Day 6.pptx
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Source Control Using Git
Source Control Using Git Source Control Using Git
Source Control Using Git
 

Último

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Último (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Git

  • 1. Git The fast version control system
  • 2. Version Control System • Allows to track changes to files • Provides repository of changes • Consists working directory / current state • VCS can be: • Centralized (Ex: SVN, CVS) • Server: single database • Clent: working directory and state. • Decentralized(Ex: BitKeeper, Mercurial, Git)
  • 3. What is Git? • free & open source • distributed version control system • Anyone can be the server • Repository coupled with working directory • Complete history • Disconnected operation • No single point of failure • Designed to be fast and efficient for small and very large size projects
  • 4. Git history • 2002 • Linus Torvalds decided to use BitKeeper for tracking Linux kernel development • Linux development scales better • 2005 • BitMover dropped free license • Linus writes his own VCS, Git
  • 5. Getting started with Git • yum install git-core • git clone --help • git config --global user.name ‘Keshavaprasad B S’ • git config --global user.email kbsbng@gmail.com
  • 6. Getting started with Git • Creating new git repo: • git init • git add • git commit • Cloning from existing repo: • man git-clone
  • 7. Git config • Types • $(prefix)/etc/gitconfig --> system • ~/.gitconfig --> global • .git/config --> local • Aliases
  • 8. Concept of working directory, index and repository • git add -> adds stuff to index • git commit -> commits stuff from index to repository • git diff -> diff between working tree and index • git diff --cached -> diff between HEAD and repository
  • 9. Concept of working directory, index and repository • git fetch-> fetch the code from remote repo to local • git pull -> pulls code from remote to local and w.d. • git checkout -> checkout code from local repo to w.d.
  • 10. Git object model • All the information needed to represent the history of a project is stored in files referenced by a 40-digit SHA1 hash. • Each object consists of type, size and contents. • 4 types of objects • Blob – stores files data (generally a file) • Tree – consists bunch of other trees or blobs (files and subdirectories) • Commit – points to a single tree. Contains meta of author, timestamp, pointer to prev. commit etc. • Tag – Marks a specific commit
  • 11. Git object model • Git show <sha>
  • 12. gitk and git log • Install gitk • git log --pretty=oneline • git log --pretty=format:'%h : %s' --topo-order –graph • git log --no-merges • git log --stat
  • 13. Git branches • git clone git@github.com:kbsbng/try_git.git • git branch hack-1 • Make changes and commit to branch and master • git rebase master hack-1 • git merge hack-1
  • 14. Git merge/rebase 1. git checkout -b mywork origin 3a. git pull 3b. git pull --rebase
  • 15. Git tags • Lighweight tags (branch that never moves) • git tag stable-1 <commit> • Tag Objects • Can include comments / signature • git tag –a stable-1 <commit>
  • 16. Stashes • git stash save “WIP for foo feature” • git stash apply • git stash list
  • 17. Some tips • Git grep can be used search through previous versions of a project without checking them out. • master@{yesterday} refers to where the master branch was yesterday.
  • 18. Git vs svn • Cheap local branching • Everything is Local • Fast • Git is small • Provides staging area • Distributed • Any workflow • Github