SlideShare a Scribd company logo
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

More Related Content

PPTX
Davinci git brown_bag
PPTX
An introduction to git
PDF
Git & GitHub N00bs
PDF
RGW S3: Features vs deep compatibility - Robin Johnson
PPTX
HTTP/2 and web development practices
PPTX
Kubernetes meetup bangalore december 2017 - v02
PPT
Git, Fast and Distributed Source Code Management
PDF
OpenStack Swift的性能调优
Davinci git brown_bag
An introduction to git
Git & GitHub N00bs
RGW S3: Features vs deep compatibility - Robin Johnson
HTTP/2 and web development practices
Kubernetes meetup bangalore december 2017 - v02
Git, Fast and Distributed Source Code Management
OpenStack Swift的性能调优

What's hot (20)

PDF
Git para novatos
ODP
Oslo Vancouver Onboarding
KEY
Intro to git
PPTX
Globus Connect Server v5 Q&A Briefing
PDF
Do You Get Git?
ODP
Git for standalone use
PDF
Managing replication of PostgreSQL, Simon Riggs
ODP
Git.odp 0
PDF
Contemporary source control for pharo
PDF
Netflix Titus WASP October 2017
PPTX
Logstash
PDF
Git & Github @ ROSEdu CDL
PPTX
OpenStack Marketing Meeting Oct 2
PDF
Approaches for duplicating Kubernetes Storage with Gluster
PPTX
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
PDF
News from Git in Java Land
PDF
Last Month in PHP - December 2015
PPTX
6.0 is coming
PDF
Archivematica Community Profile: University of Houston by Bethany Scott
PDF
Contributing to open source using Git
Git para novatos
Oslo Vancouver Onboarding
Intro to git
Globus Connect Server v5 Q&A Briefing
Do You Get Git?
Git for standalone use
Managing replication of PostgreSQL, Simon Riggs
Git.odp 0
Contemporary source control for pharo
Netflix Titus WASP October 2017
Logstash
Git & Github @ ROSEdu CDL
OpenStack Marketing Meeting Oct 2
Approaches for duplicating Kubernetes Storage with Gluster
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
News from Git in Java Land
Last Month in PHP - December 2015
6.0 is coming
Archivematica Community Profile: University of Houston by Bethany Scott
Contributing to open source using Git
Ad

Similar to Git (20)

PPTX
Git.From thorns to the stars
PPT
Introduction to git
PPTX
Git and github
PPT
Introduction to Git
PDF
Git for folk who like GUIs
PDF
Mini git tutorial
PDF
The Basics of Open Source Collaboration With Git and GitHub
PDF
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
PPT
Git installation and configuration
PPTX
GitHub_For_Beginners_Presentationss.pptx
PPTX
PPTX
git and github-1.pptx
PPTX
Introduction to git hub
PPTX
GitHub_Sharing_Session_1_GitHub_Sharing_Session.pptx
PPT
Git is a distributed version control system .
PPTX
Sprints-Day 6.pptx
KEY
Let's Git this Party Started: An Introduction to Git and GitHub
PPT
Git 101 - Crash Course in Version Control using Git
PPTX
Git and Github
PPTX
Source Control Using Git
Git.From thorns to the stars
Introduction to git
Git and github
Introduction to Git
Git for folk who like GUIs
Mini git tutorial
The Basics of Open Source Collaboration With Git and GitHub
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Git installation and configuration
GitHub_For_Beginners_Presentationss.pptx
git and github-1.pptx
Introduction to git hub
GitHub_Sharing_Session_1_GitHub_Sharing_Session.pptx
Git is a distributed version control system .
Sprints-Day 6.pptx
Let's Git this Party Started: An Introduction to Git and GitHub
Git 101 - Crash Course in Version Control using Git
Git and Github
Source Control Using Git
Ad

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Approach and Philosophy of On baking technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Electronic commerce courselecture one. Pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
NewMind AI Weekly Chronicles - August'25 Week I
Approach and Philosophy of On baking technology
20250228 LYD VKU AI Blended-Learning.pptx
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars
Electronic commerce courselecture one. Pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
sap open course for s4hana steps from ECC to s4
Spectral efficient network and resource selection model in 5G networks
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The AUB Centre for AI in Media Proposal.docx
Reach Out and Touch Someone: Haptics and Empathic Computing
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.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