SlideShare a Scribd company logo
1 of 18
Download to read offline
What GIT is!
Harry Kalogirou
twitter: @harkal
What GIT is
• The most widely used version control system in the world
• At the same time, the most misunderstood version control system
• Created by Linus Torvalds to handle the Linux kernel source code
-John Wishfulthinking
“GIT is simpler than you think”
GIT is not SVN
• Τrying to apply past knowledge of SVN to
GIT is the root of all evil
• Subversion fits in nicely with our existing
computing paradigms. Everybody
understands files and folders. Everybody
knows that revision #10 was the one after
#9 and before #11.
• That is the reason why it’s all rainbows and
unicorns only until you start talking about
branching, merging, re-basing, multiple
remotes, remote-tracking branches,
detached HEAD states, etc
Αποτάξομεν το SVN?!
GIT is not SVN
• GIT looks so complex, but only if you try to look at it through Subversion
• GIT looks very simple once you understand how it really works underneath
• And suddenly a “no-fast-forward merge” makes sense and a “rebase pull”
makes you look smart in front of your friends.
Understanding GIT
• So the key to understanding GIT is to
figure out the simple things that GIT
does under the hood
• How it stores data
• And how all you do translates to those
simple things
How GIT stores its data?
• Where are all the files, commits, tags, etc stored?
• It must be very complex, right?NO
What is at the core of GIT
• At the core of GIT, like other VCS, is the repository
• That repository is a SIMPLE key-value datastore, where everything is
stored
• All commits, files, tags and file system tree nodes are different types of
objects living in this repository.
• All indexed by their SHA-1 hash
• All live under .git/!
• The whole repository is stored under that directory. There is no central
repository. That is the repository.
What kind of objects are there?
• Blobs
• Tree objects
• Commit objects
• Tag objects
• References
Example
• Consider this simple repository:
README
src/
src/main.c
This would be represented by two tree objects:
• one for the root directory
• and another for the src/ directory
!
And two blob objects:
• one for the contents of the file README
• and another for the file main.c
Example
So eventually we have 4 objects in our key/value store, each
with its own SHA-1 key
!
These are actually files under .git/objects *
!
Issuing a “find .git/object -type f” command reveals the
secrets:
*as Linus was initially too bored to actually make a key/value store and used the filesystem
Charilaos-MacBook-Pro:test harkal$ find .git/objects -type f
.git/objects/b8/a08da3d1bbc3ab168a10859f34900d87be1de2
.git/objects/ba/e4c2f5634a0aa40b4ba7c271597d8a716e8116
.git/objects/cb/3f7482fa46d2ac25648a694127f23c1976b696
.git/objects/d3/ea3e42ec65b3606a9d9db8bba9be5ed8044f16
What a commit is
• A commit is just another object that contains:
• The SHA-1 hash of the tree it talks about
• The SHA-1 hashes of the parent commits
• the author (name, email, and time)
• the commiter (name, email, and time)
• the comments you provide
• As with all objects the above contents are hashed and stored under .git/objects.
That hash is the hash you use to reference that commit
That is basically it
You can use git now in all its power…
as long as you enjoy using hashes like this:
b8a08da3d1bbc3ab168a10859f34900d87be1de2
• Most of the rest is making it more human
References
• To save you from having to memorize hashes, GIT has references,
or “refs”.
• A reference is simply a file stored somewhere in .git/refs,
containing the hash of a commit object.
• Branches, tags, remote branches, HEAD are all just references
So putting it in perspective
• Your “develop” and “master” branches are just two files under .git/
refs, that point to a simple commit.
• To checkout that: It gets the commit, and recurses the tree it points
to and create the files.
• To get the commit history line of that branch: It follows all parent
commits in that commit.
So putting it in perspective
• What branch you are on? Just a special reference called “HEAD”
• Does HEAD not point to a branch but a simple commit? Then you
are in detached head state
So putting it in perspective
• All GIT’s commands and cryptic, difficult to understand notions,
fiddle arround with just these objects.
• No need to map it to any

SVN notion
• You just need a workflow

that you follow, to keep it

sane.
• There is no spoon!
Ευχαριστώ :)
With great power comes great responsibility
— Peter Parker

More Related Content

Viewers also liked (8)

Bloom Consulting Country Brand Ranking Trade 2013
Bloom Consulting Country Brand Ranking Trade 2013Bloom Consulting Country Brand Ranking Trade 2013
Bloom Consulting Country Brand Ranking Trade 2013
 
Bloom consulting country brand ranking trade 2012
Bloom consulting country brand ranking trade 2012Bloom consulting country brand ranking trade 2012
Bloom consulting country brand ranking trade 2012
 
Bloom Consulting Country Brand Ranking Tourism 2013
Bloom Consulting Country Brand Ranking Tourism 2013Bloom Consulting Country Brand Ranking Tourism 2013
Bloom Consulting Country Brand Ranking Tourism 2013
 
Bloom Consulting Country Brand Ranking Tourism 2011
Bloom Consulting Country Brand Ranking Tourism 2011Bloom Consulting Country Brand Ranking Tourism 2011
Bloom Consulting Country Brand Ranking Tourism 2011
 
Bloom consulting us state brand ranking tourism 2012
Bloom consulting us state brand ranking tourism 2012Bloom consulting us state brand ranking tourism 2012
Bloom consulting us state brand ranking tourism 2012
 
Bloom Consulting Country Brand Ranking Trade 2011
Bloom Consulting Country Brand Ranking Trade 2011Bloom Consulting Country Brand Ranking Trade 2011
Bloom Consulting Country Brand Ranking Trade 2011
 
Bloom consulting country brand ranking tourism 2012
Bloom consulting country brand ranking tourism 2012Bloom consulting country brand ranking tourism 2012
Bloom consulting country brand ranking tourism 2012
 
Country Brand Ranking © 2014/2015 Tourism Edition
Country Brand Ranking © 2014/2015 Tourism Edition Country Brand Ranking © 2014/2015 Tourism Edition
Country Brand Ranking © 2014/2015 Tourism Edition
 

Similar to What git is

Git.From thorns to the stars
Git.From thorns to the starsGit.From thorns to the stars
Git.From thorns to the stars
Strannik_2013
 

Similar to What git is (20)

Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Demystifying git
Demystifying git Demystifying git
Demystifying git
 
Introduction to Git for developers
Introduction to Git for developersIntroduction to Git for developers
Introduction to Git for developers
 
Gitlikeapro 2019
Gitlikeapro 2019Gitlikeapro 2019
Gitlikeapro 2019
 
Git censored.key
Git censored.keyGit censored.key
Git censored.key
 
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)
 
Demo
DemoDemo
Demo
 
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of GitGit Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
 
Git session-2012-2013
Git session-2012-2013Git session-2012-2013
Git session-2012-2013
 
Git Real
Git RealGit Real
Git Real
 
Git
GitGit
Git
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
An introduction to git
An introduction to gitAn introduction to git
An introduction to git
 
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
 
Git vs Subversion: ¿Cuando elegir uno u otro?
Git vs Subversion: ¿Cuando elegir uno u otro?Git vs Subversion: ¿Cuando elegir uno u otro?
Git vs Subversion: ¿Cuando elegir uno u otro?
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Git(hub) for windows developers
Git(hub) for windows developersGit(hub) for windows developers
Git(hub) for windows developers
 
Git presentation to some coworkers some time ago
Git presentation to some coworkers some time agoGit presentation to some coworkers some time ago
Git presentation to some coworkers some time ago
 

Recently uploaded

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Recently uploaded (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 

What git is

  • 1. What GIT is! Harry Kalogirou twitter: @harkal
  • 2. What GIT is • The most widely used version control system in the world • At the same time, the most misunderstood version control system • Created by Linus Torvalds to handle the Linux kernel source code
  • 3. -John Wishfulthinking “GIT is simpler than you think”
  • 4. GIT is not SVN • Τrying to apply past knowledge of SVN to GIT is the root of all evil • Subversion fits in nicely with our existing computing paradigms. Everybody understands files and folders. Everybody knows that revision #10 was the one after #9 and before #11. • That is the reason why it’s all rainbows and unicorns only until you start talking about branching, merging, re-basing, multiple remotes, remote-tracking branches, detached HEAD states, etc Αποτάξομεν το SVN?!
  • 5. GIT is not SVN • GIT looks so complex, but only if you try to look at it through Subversion • GIT looks very simple once you understand how it really works underneath • And suddenly a “no-fast-forward merge” makes sense and a “rebase pull” makes you look smart in front of your friends.
  • 6. Understanding GIT • So the key to understanding GIT is to figure out the simple things that GIT does under the hood • How it stores data • And how all you do translates to those simple things
  • 7. How GIT stores its data? • Where are all the files, commits, tags, etc stored? • It must be very complex, right?NO
  • 8. What is at the core of GIT • At the core of GIT, like other VCS, is the repository • That repository is a SIMPLE key-value datastore, where everything is stored • All commits, files, tags and file system tree nodes are different types of objects living in this repository. • All indexed by their SHA-1 hash • All live under .git/! • The whole repository is stored under that directory. There is no central repository. That is the repository.
  • 9. What kind of objects are there? • Blobs • Tree objects • Commit objects • Tag objects • References
  • 10. Example • Consider this simple repository: README src/ src/main.c This would be represented by two tree objects: • one for the root directory • and another for the src/ directory ! And two blob objects: • one for the contents of the file README • and another for the file main.c
  • 11. Example So eventually we have 4 objects in our key/value store, each with its own SHA-1 key ! These are actually files under .git/objects * ! Issuing a “find .git/object -type f” command reveals the secrets: *as Linus was initially too bored to actually make a key/value store and used the filesystem Charilaos-MacBook-Pro:test harkal$ find .git/objects -type f .git/objects/b8/a08da3d1bbc3ab168a10859f34900d87be1de2 .git/objects/ba/e4c2f5634a0aa40b4ba7c271597d8a716e8116 .git/objects/cb/3f7482fa46d2ac25648a694127f23c1976b696 .git/objects/d3/ea3e42ec65b3606a9d9db8bba9be5ed8044f16
  • 12. What a commit is • A commit is just another object that contains: • The SHA-1 hash of the tree it talks about • The SHA-1 hashes of the parent commits • the author (name, email, and time) • the commiter (name, email, and time) • the comments you provide • As with all objects the above contents are hashed and stored under .git/objects. That hash is the hash you use to reference that commit
  • 13. That is basically it You can use git now in all its power… as long as you enjoy using hashes like this: b8a08da3d1bbc3ab168a10859f34900d87be1de2 • Most of the rest is making it more human
  • 14. References • To save you from having to memorize hashes, GIT has references, or “refs”. • A reference is simply a file stored somewhere in .git/refs, containing the hash of a commit object. • Branches, tags, remote branches, HEAD are all just references
  • 15. So putting it in perspective • Your “develop” and “master” branches are just two files under .git/ refs, that point to a simple commit. • To checkout that: It gets the commit, and recurses the tree it points to and create the files. • To get the commit history line of that branch: It follows all parent commits in that commit.
  • 16. So putting it in perspective • What branch you are on? Just a special reference called “HEAD” • Does HEAD not point to a branch but a simple commit? Then you are in detached head state
  • 17. So putting it in perspective • All GIT’s commands and cryptic, difficult to understand notions, fiddle arround with just these objects. • No need to map it to any
 SVN notion • You just need a workflow
 that you follow, to keep it
 sane. • There is no spoon!
  • 18. Ευχαριστώ :) With great power comes great responsibility — Peter Parker