SlideShare ist ein Scribd-Unternehmen logo
1 von 56
Downloaden Sie, um offline zu lesen
GIT Internals
Pedro Melo <{mailto,xmpp}:melo@simplicidade.org>
A short GIT History
• 2002 Apr 2005: The BitKeeper Wars
• Apr 2005: Episode IV - A New Hope
• July 2005: Hamano is the new maintainer
• Late 2008: GitHub hits the spotlight
   “I’m an egotistical bastard, and I name
        all my projects after myself.
        First Linux, now git.” – Linus
on
 A short GIT History
 Person al take



• 2002 Apr 2005: The BitKeeper Wars
• Apr 2005: Episode IV - A New Hope
• July 2005: Hamano is the new maintainer
• Late 2008: GitHub hits the spotlight
   “I’m an egotistical bastard, and I name
        all my projects after myself.
        First Linux, now git.” – Linus
GIT rules (without !!)
• Track content, not changes
• Simple repository
• Complex software
• Its easier to update the software, complex
  to update all the repos so far

   Git Mantra: http://bit.ly/git-phylosophy
In other words, I'm right. I'm
always right, but sometimes
I'm more right than other
times. And dammit, when I say
"files don't matter", I'm really
really Right(tm).
                       Linus
Strong Points

• Non-Linear development
• Distributed Development
 • Centralized development is a subcase
• Efficiency
• Toolkit Design
Objects
• Git repositories store objects
• Stored in the Object Database
• Inside the Git directory
 • .git at the root of your project
• Four major object types
• Objects are compressed for storage (zlib)
• SHA1 of header+content ID
The Blob


• Files are stored as blobs
• Only content, no metadata
Meet the blob

blob [content_size]0
Your content goes here after the header

I like pizza with apples
The tree

• Trees store directories
• Mode, type, pointer and name
• Recursive, trees can contain trees
• Stored as a simple text file
Meet the tree
tree [content_size]0
100644 blob b5f21a README
100644 blob afe433 Makefile.PL
040000 tree a42cd0 lib
The commit

• The object that makes history
• Pointer to a tree and the parent(s)
  commits if any
• Author, committer and commit
  message
Meet the commit...
commit [content_size]0
tree 23edfc
author Pedro Melo <melo@mini.me> 1243036800
committer Pedro Melo <melo@mini.me> 1243036800

commit without a parent

usually called first commit
...and its child the other
              commit
commit [content_size]0
tree fde45c
parent 3454df
author Pedro Melo <melo@mini.me> 1243036932
committer Pedro Melo <melo@mini.me> 1243036932

and we fixed that nasty bug

after all, they do tend to crop up
The tag

• A name for a particular commit
• Can contain a message
• Optionally GPG signed
 • Allows for cryptographically secure
    releases
Meet the tag
tag [content_size]0
object 123fec
type commit
tag v1
tagger Pedro Melo <melo@mini.me> 1243037423

made it to 1.0!
Git Data Model Recap

• Immutable objects
• A file per object
• Repacked into object packs for efficiency
• Organized as a directed acyclic graph
proj/
 Makefile.PL
 lib/
   Cool.pm
proj/
 Makefile.PL
 lib/
   Cool.pm
proj/
           Makefile.PL
           lib/
             Cool.pm




Cool.pm
proj/
           Makefile.PL
           lib/
             Cool.pm




Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL
   lib/




 Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL
   lib/




 Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL
   lib/




 Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL
   lib/




 Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL   Makefile.PL
   lib/         lib/




 Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL   Makefile.PL
   lib/         lib/




 Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL   Makefile.PL
   lib/         lib/




 Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL   Makefile.PL
   lib/         lib/




 Cool.pm                   Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL   Makefile.PL    Makefile.PL
   lib/         lib/          lib/




 Cool.pm                    Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL   Makefile.PL    Makefile.PL
   lib/         lib/          lib/




 Cool.pm                    Cool.pm
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL   Makefile.PL    Makefile.PL
   lib/         lib/          lib/




 Cool.pm                    Cool.pm
References
• “Names” for commits
• Mutable, they point to a specific commit
  and move to a new one after each
  commit




                                            Name
• A branch is a reference, a name to a
  commit
• Special HEAD reference: points to a
  reference
proj/
              Makefile.PL
              lib/
                Cool.pm




Makefile.PL   Makefile.PL    Makefile.PL
   lib/         lib/          lib/




 Cool.pm                    Cool.pm
master   HEAD
master   HEAD
master   HEAD

 test
master

 test    HEAD
master




 test    HEAD
master   HEAD




 test
test   master


          HEAD
test   master
           Merge
test
                Merge




       master
test   master
           Rebase
master
           Rebase




test
master
           Rebase




test
Rebase + Merge




          master
           test
Rebase + Merge




          master
           test
Non-SCM uses for Git
• Leverage strengths
 • immutable
 • over network pulls only missing objects
 • fast checkout (compare to copy, less to
    read)
 • easy rollback
Beware of weak points

• Always stores full copy of files
 • not good for backups of DB dumps
• Full history more disk space
 • this might chance as “shallow clones” gain
    funcionality...
Content distribution
• Updates done in a master, central
  repository
• Hierarchy of slave repositories
• Fast sync between repositories, fast
  checkout
• Can be automated with hooks
• Useful if you have lots of static files, faster
  than rsync
Read-only filesystem
• Design web server that fetch objects
  directly from the object database
• Compact storage, efficient retrieval
• Packs of objects also very VM friendly,
  mmap ready
• Some solutions already available OSS
Wiki/Ticketing backend

• Use git repository as storage for wiki or
  ticketing systems
• Good match for distributed developement
• Several solutions already available OSS
• ... but similar to SCM usages
That’s all folks!
• I’ll be around #codebits, feel free to ask me
  stuff
• If you want a git as a SCM demo, lets get
  organized and I’ll do a impromptu
  presentation, or even private
  lapdan^H^H^H^H^Hdemos
• After #codebits
  <{mailto,xmpp}:melo@simplicidade.org
About Git
                         http://git-scm.com/
  Git Internals: http://peepcode.com/products/git-internals-pdf
                    Git book: http://progit.org/



       About Me
    http://simplicidade.org/notes/
             @pedromelo
{mailto,xmpp}:melo@simplicidade.org
             skype:melopt
        http://github.com/melo
  http://www.slideshare.net/melopt

Weitere ähnliche Inhalte

Was ist angesagt?

Rake: Not Your Father's Build Tool
Rake: Not Your Father's Build ToolRake: Not Your Father's Build Tool
Rake: Not Your Father's Build Toolfilmprog
 
Writing a fast HTTP parser
Writing a fast HTTP parserWriting a fast HTTP parser
Writing a fast HTTP parserfukamachi
 
But we're already open source! Why would I want to bring my code to Apache?
But we're already open source! Why would I want to bring my code to Apache?But we're already open source! Why would I want to bring my code to Apache?
But we're already open source! Why would I want to bring my code to Apache?gagravarr
 
Building Awesome CLI apps in Go
Building Awesome CLI apps in GoBuilding Awesome CLI apps in Go
Building Awesome CLI apps in GoSteven Francia
 
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common LispLisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lispmasayukitakagi
 
Preparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for TranslationsPreparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for TranslationsHPCC Systems
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the worldHiroshi SHIBATA
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP PerspectiveBarry Jones
 
Taming the resource tiger
Taming the resource tigerTaming the resource tiger
Taming the resource tigerElizabeth Smith
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?Hiroshi SHIBATA
 
An introduction to git
An introduction to gitAn introduction to git
An introduction to gitolberger
 
Building GUI App with Electron and Lisp
Building GUI App with Electron and LispBuilding GUI App with Electron and Lisp
Building GUI App with Electron and Lispfukamachi
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Hiroshi SHIBATA
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Mandi Walls
 
Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speedSATOSHI TAGOMORI
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devopsRob Kinyon
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled BundlerHiroshi SHIBATA
 
Ruby Security the Hard Way
Ruby Security the Hard WayRuby Security the Hard Way
Ruby Security the Hard WayHiroshi SHIBATA
 

Was ist angesagt? (20)

Rake: Not Your Father's Build Tool
Rake: Not Your Father's Build ToolRake: Not Your Father's Build Tool
Rake: Not Your Father's Build Tool
 
Writing a fast HTTP parser
Writing a fast HTTP parserWriting a fast HTTP parser
Writing a fast HTTP parser
 
About Clack
About ClackAbout Clack
About Clack
 
But we're already open source! Why would I want to bring my code to Apache?
But we're already open source! Why would I want to bring my code to Apache?But we're already open source! Why would I want to bring my code to Apache?
But we're already open source! Why would I want to bring my code to Apache?
 
Building Awesome CLI apps in Go
Building Awesome CLI apps in GoBuilding Awesome CLI apps in Go
Building Awesome CLI apps in Go
 
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common LispLisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
Lisp Meet Up #31, Clake: a GNU make-like build utility in Common Lisp
 
Preparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for TranslationsPreparing an Open Source Documentation Repository for Translations
Preparing an Open Source Documentation Repository for Translations
 
How to distribute Ruby to the world
How to distribute Ruby to the worldHow to distribute Ruby to the world
How to distribute Ruby to the world
 
Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP Perspective
 
Taming the resource tiger
Taming the resource tigerTaming the resource tiger
Taming the resource tiger
 
How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?How to develop the Standard Libraries of Ruby?
How to develop the Standard Libraries of Ruby?
 
An introduction to git
An introduction to gitAn introduction to git
An introduction to git
 
Building GUI App with Electron and Lisp
Building GUI App with Electron and LispBuilding GUI App with Electron and Lisp
Building GUI App with Electron and Lisp
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014Open Source Tools for Leveling Up Operations FOSSET 2014
Open Source Tools for Leveling Up Operations FOSSET 2014
 
Ractor's speed is not light-speed
Ractor's speed is not light-speedRactor's speed is not light-speed
Ractor's speed is not light-speed
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devops
 
The Future of Bundled Bundler
The Future of Bundled BundlerThe Future of Bundled Bundler
The Future of Bundled Bundler
 
Ruby Security the Hard Way
Ruby Security the Hard WayRuby Security the Hard Way
Ruby Security the Hard Way
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 

Andere mochten auch

Big Data: Implications for Marketing and Strategy
Big Data: Implications for Marketing and StrategyBig Data: Implications for Marketing and Strategy
Big Data: Implications for Marketing and StrategyC.K. Kumar
 
C6 deploying applications to your private cloud 7 to 10 times faster
C6   deploying applications to your private cloud 7 to 10 times fasterC6   deploying applications to your private cloud 7 to 10 times faster
C6 deploying applications to your private cloud 7 to 10 times fasterDr. Wilfred Lin (Ph.D.)
 
A7 getting value from big data how to get there quickly and leverage your c...
A7   getting value from big data how to get there quickly and leverage your c...A7   getting value from big data how to get there quickly and leverage your c...
A7 getting value from big data how to get there quickly and leverage your c...Dr. Wilfred Lin (Ph.D.)
 
Large-scale digitisation options at the Natural History Museum, London.
Large-scale digitisation options at the Natural History Museum, London.Large-scale digitisation options at the Natural History Museum, London.
Large-scale digitisation options at the Natural History Museum, London.Vince Smith
 
Methodological principles in dealing with Big Data, Reijo Sund
Methodological principles in dealing with Big Data, Reijo SundMethodological principles in dealing with Big Data, Reijo Sund
Methodological principles in dealing with Big Data, Reijo SundTilastokeskus
 
Privacy in a digital world
Privacy in a digital worldPrivacy in a digital world
Privacy in a digital worldrobkitchin
 
Chapter 02 The Internet
Chapter 02 The InternetChapter 02 The Internet
Chapter 02 The Internetxtin101
 
Chapter 06 Inside Computers and Mobile Devices
Chapter 06 Inside Computers and Mobile DevicesChapter 06 Inside Computers and Mobile Devices
Chapter 06 Inside Computers and Mobile Devicesxtin101
 
Chapter 05 Digital Safety and Security
Chapter 05 Digital Safety and SecurityChapter 05 Digital Safety and Security
Chapter 05 Digital Safety and Securityxtin101
 
Research on data journalism: What is there to investigate? Insights from a st...
Research on data journalism: What is there to investigate? Insights from a st...Research on data journalism: What is there to investigate? Insights from a st...
Research on data journalism: What is there to investigate? Insights from a st...Julian Ausserhofer
 
»Big data – small problems?« - Ethische Perspektiven auf Forschung unter Zuhi...
»Big data – small problems?« - Ethische Perspektiven auf Forschung unter Zuhi...»Big data – small problems?« - Ethische Perspektiven auf Forschung unter Zuhi...
»Big data – small problems?« - Ethische Perspektiven auf Forschung unter Zuhi...Nele Heise
 

Andere mochten auch (13)

Chapter 02
Chapter 02Chapter 02
Chapter 02
 
Big Data: Implications for Marketing and Strategy
Big Data: Implications for Marketing and StrategyBig Data: Implications for Marketing and Strategy
Big Data: Implications for Marketing and Strategy
 
C6 deploying applications to your private cloud 7 to 10 times faster
C6   deploying applications to your private cloud 7 to 10 times fasterC6   deploying applications to your private cloud 7 to 10 times faster
C6 deploying applications to your private cloud 7 to 10 times faster
 
A7 getting value from big data how to get there quickly and leverage your c...
A7   getting value from big data how to get there quickly and leverage your c...A7   getting value from big data how to get there quickly and leverage your c...
A7 getting value from big data how to get there quickly and leverage your c...
 
Large-scale digitisation options at the Natural History Museum, London.
Large-scale digitisation options at the Natural History Museum, London.Large-scale digitisation options at the Natural History Museum, London.
Large-scale digitisation options at the Natural History Museum, London.
 
Methodological principles in dealing with Big Data, Reijo Sund
Methodological principles in dealing with Big Data, Reijo SundMethodological principles in dealing with Big Data, Reijo Sund
Methodological principles in dealing with Big Data, Reijo Sund
 
Privacy in a digital world
Privacy in a digital worldPrivacy in a digital world
Privacy in a digital world
 
Chapter 02 The Internet
Chapter 02 The InternetChapter 02 The Internet
Chapter 02 The Internet
 
Chapter 06 Inside Computers and Mobile Devices
Chapter 06 Inside Computers and Mobile DevicesChapter 06 Inside Computers and Mobile Devices
Chapter 06 Inside Computers and Mobile Devices
 
Big Search with Big Data Principles
Big Search with Big Data PrinciplesBig Search with Big Data Principles
Big Search with Big Data Principles
 
Chapter 05 Digital Safety and Security
Chapter 05 Digital Safety and SecurityChapter 05 Digital Safety and Security
Chapter 05 Digital Safety and Security
 
Research on data journalism: What is there to investigate? Insights from a st...
Research on data journalism: What is there to investigate? Insights from a st...Research on data journalism: What is there to investigate? Insights from a st...
Research on data journalism: What is there to investigate? Insights from a st...
 
»Big data – small problems?« - Ethische Perspektiven auf Forschung unter Zuhi...
»Big data – small problems?« - Ethische Perspektiven auf Forschung unter Zuhi...»Big data – small problems?« - Ethische Perspektiven auf Forschung unter Zuhi...
»Big data – small problems?« - Ethische Perspektiven auf Forschung unter Zuhi...
 

Ähnlich wie Git Internals

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 GitNicola Costantino
 
Git censored.key
Git censored.keyGit censored.key
Git censored.keymkramer2
 
Introduction to new technologies in drupal 8
Introduction to new technologies in drupal 8Introduction to new technologies in drupal 8
Introduction to new technologies in drupal 8naxoc
 
Containerd + buildkit breakout
Containerd + buildkit breakoutContainerd + buildkit breakout
Containerd + buildkit breakoutDocker, Inc.
 
Docker Platform Internals: Taking runtimes and image creation to the next lev...
Docker Platform Internals: Taking runtimes and image creation to the next lev...Docker Platform Internals: Taking runtimes and image creation to the next lev...
Docker Platform Internals: Taking runtimes and image creation to the next lev...Docker, Inc.
 
Github for Serious Business Professional
Github for Serious Business ProfessionalGithub for Serious Business Professional
Github for Serious Business Professionalzwheller
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Ahmed El-Arabawy
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIsTim Osborn
 
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
 
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareChris Jean
 
Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPressMarko Heijnen
 
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
 
2013 t-dose - libre office easyhacks
2013   t-dose - libre office easyhacks2013   t-dose - libre office easyhacks
2013 t-dose - libre office easyhacksRob Snelders
 
[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't CodeChristopher Schmitt
 
Introduction to Git for developers
Introduction to Git for developersIntroduction to Git for developers
Introduction to Git for developersDmitry Guyvoronsky
 

Ähnlich wie Git Internals (20)

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
 
Jekyll, static websites generator
Jekyll, static websites generatorJekyll, static websites generator
Jekyll, static websites generator
 
Fedora4
Fedora4Fedora4
Fedora4
 
Git censored.key
Git censored.keyGit censored.key
Git censored.key
 
Introduction to new technologies in drupal 8
Introduction to new technologies in drupal 8Introduction to new technologies in drupal 8
Introduction to new technologies in drupal 8
 
Containerd + buildkit breakout
Containerd + buildkit breakoutContainerd + buildkit breakout
Containerd + buildkit breakout
 
Docker Platform Internals: Taking runtimes and image creation to the next lev...
Docker Platform Internals: Taking runtimes and image creation to the next lev...Docker Platform Internals: Taking runtimes and image creation to the next lev...
Docker Platform Internals: Taking runtimes and image creation to the next lev...
 
Github for Serious Business Professional
Github for Serious Business ProfessionalGithub for Serious Business Professional
Github for Serious Business Professional
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
 
Gitlikeapro 2019
Gitlikeapro 2019Gitlikeapro 2019
Gitlikeapro 2019
 
Git for folk who like GUIs
Git for folk who like GUIsGit for folk who like GUIs
Git for folk who like GUIs
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging Software
 
Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPress
 
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
 
2013 t-dose - libre office easyhacks
2013   t-dose - libre office easyhacks2013   t-dose - libre office easyhacks
2013 t-dose - libre office easyhacks
 
[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code[artifactconf] Github for People Who Don't Code
[artifactconf] Github for People Who Don't Code
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Introduction to Git for developers
Introduction to Git for developersIntroduction to Git for developers
Introduction to Git for developers
 
Python Tutorial Part 2
Python Tutorial Part 2Python Tutorial Part 2
Python Tutorial Part 2
 

Mehr von Pedro Melo

Enterprise git
Enterprise gitEnterprise git
Enterprise gitPedro Melo
 
EDA with SAPO Broker
EDA with SAPO BrokerEDA with SAPO Broker
EDA with SAPO BrokerPedro Melo
 
Perl Instruments
Perl InstrumentsPerl Instruments
Perl InstrumentsPedro Melo
 
Network Programming With Anyevent
Network Programming With AnyeventNetwork Programming With Anyevent
Network Programming With AnyeventPedro Melo
 

Mehr von Pedro Melo (6)

Enterprise git
Enterprise gitEnterprise git
Enterprise git
 
Plack
PlackPlack
Plack
 
EDA with SAPO Broker
EDA with SAPO BrokerEDA with SAPO Broker
EDA with SAPO Broker
 
WTF is XMPP?
WTF is XMPP?WTF is XMPP?
WTF is XMPP?
 
Perl Instruments
Perl InstrumentsPerl Instruments
Perl Instruments
 
Network Programming With Anyevent
Network Programming With AnyeventNetwork Programming With Anyevent
Network Programming With Anyevent
 

Kürzlich hochgeladen

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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
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
 
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
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 

Kürzlich hochgeladen (20)

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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
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...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 

Git Internals

  • 1. GIT Internals Pedro Melo <{mailto,xmpp}:melo@simplicidade.org>
  • 2. A short GIT History • 2002 Apr 2005: The BitKeeper Wars • Apr 2005: Episode IV - A New Hope • July 2005: Hamano is the new maintainer • Late 2008: GitHub hits the spotlight “I’m an egotistical bastard, and I name all my projects after myself. First Linux, now git.” – Linus
  • 3. on A short GIT History Person al take • 2002 Apr 2005: The BitKeeper Wars • Apr 2005: Episode IV - A New Hope • July 2005: Hamano is the new maintainer • Late 2008: GitHub hits the spotlight “I’m an egotistical bastard, and I name all my projects after myself. First Linux, now git.” – Linus
  • 4. GIT rules (without !!) • Track content, not changes • Simple repository • Complex software • Its easier to update the software, complex to update all the repos so far Git Mantra: http://bit.ly/git-phylosophy
  • 5. In other words, I'm right. I'm always right, but sometimes I'm more right than other times. And dammit, when I say "files don't matter", I'm really really Right(tm). Linus
  • 6. Strong Points • Non-Linear development • Distributed Development • Centralized development is a subcase • Efficiency • Toolkit Design
  • 7. Objects • Git repositories store objects • Stored in the Object Database • Inside the Git directory • .git at the root of your project • Four major object types • Objects are compressed for storage (zlib) • SHA1 of header+content ID
  • 8. The Blob • Files are stored as blobs • Only content, no metadata
  • 9. Meet the blob blob [content_size]0 Your content goes here after the header I like pizza with apples
  • 10. The tree • Trees store directories • Mode, type, pointer and name • Recursive, trees can contain trees • Stored as a simple text file
  • 11. Meet the tree tree [content_size]0 100644 blob b5f21a README 100644 blob afe433 Makefile.PL 040000 tree a42cd0 lib
  • 12. The commit • The object that makes history • Pointer to a tree and the parent(s) commits if any • Author, committer and commit message
  • 13. Meet the commit... commit [content_size]0 tree 23edfc author Pedro Melo <melo@mini.me> 1243036800 committer Pedro Melo <melo@mini.me> 1243036800 commit without a parent usually called first commit
  • 14. ...and its child the other commit commit [content_size]0 tree fde45c parent 3454df author Pedro Melo <melo@mini.me> 1243036932 committer Pedro Melo <melo@mini.me> 1243036932 and we fixed that nasty bug after all, they do tend to crop up
  • 15. The tag • A name for a particular commit • Can contain a message • Optionally GPG signed • Allows for cryptographically secure releases
  • 16. Meet the tag tag [content_size]0 object 123fec type commit tag v1 tagger Pedro Melo <melo@mini.me> 1243037423 made it to 1.0!
  • 17. Git Data Model Recap • Immutable objects • A file per object • Repacked into object packs for efficiency • Organized as a directed acyclic graph
  • 18.
  • 21. proj/ Makefile.PL lib/ Cool.pm Cool.pm
  • 22. proj/ Makefile.PL lib/ Cool.pm Cool.pm
  • 23. proj/ Makefile.PL lib/ Cool.pm Makefile.PL lib/ Cool.pm
  • 24. proj/ Makefile.PL lib/ Cool.pm Makefile.PL lib/ Cool.pm
  • 25. proj/ Makefile.PL lib/ Cool.pm Makefile.PL lib/ Cool.pm
  • 26. proj/ Makefile.PL lib/ Cool.pm Makefile.PL lib/ Cool.pm
  • 27. proj/ Makefile.PL lib/ Cool.pm Makefile.PL Makefile.PL lib/ lib/ Cool.pm
  • 28. proj/ Makefile.PL lib/ Cool.pm Makefile.PL Makefile.PL lib/ lib/ Cool.pm
  • 29. proj/ Makefile.PL lib/ Cool.pm Makefile.PL Makefile.PL lib/ lib/ Cool.pm
  • 30. proj/ Makefile.PL lib/ Cool.pm Makefile.PL Makefile.PL lib/ lib/ Cool.pm Cool.pm
  • 31. proj/ Makefile.PL lib/ Cool.pm Makefile.PL Makefile.PL Makefile.PL lib/ lib/ lib/ Cool.pm Cool.pm
  • 32. proj/ Makefile.PL lib/ Cool.pm Makefile.PL Makefile.PL Makefile.PL lib/ lib/ lib/ Cool.pm Cool.pm
  • 33. proj/ Makefile.PL lib/ Cool.pm Makefile.PL Makefile.PL Makefile.PL lib/ lib/ lib/ Cool.pm Cool.pm
  • 34. References • “Names” for commits • Mutable, they point to a specific commit and move to a new one after each commit Name • A branch is a reference, a name to a commit • Special HEAD reference: points to a reference
  • 35. proj/ Makefile.PL lib/ Cool.pm Makefile.PL Makefile.PL Makefile.PL lib/ lib/ lib/ Cool.pm Cool.pm
  • 36. master HEAD
  • 37. master HEAD
  • 38. master HEAD test
  • 39. master test HEAD
  • 40. master test HEAD
  • 41. master HEAD test
  • 42. test master HEAD
  • 43. test master Merge
  • 44. test Merge master
  • 45. test master Rebase
  • 46. master Rebase test
  • 47. master Rebase test
  • 48. Rebase + Merge master test
  • 49. Rebase + Merge master test
  • 50. Non-SCM uses for Git • Leverage strengths • immutable • over network pulls only missing objects • fast checkout (compare to copy, less to read) • easy rollback
  • 51. Beware of weak points • Always stores full copy of files • not good for backups of DB dumps • Full history more disk space • this might chance as “shallow clones” gain funcionality...
  • 52. Content distribution • Updates done in a master, central repository • Hierarchy of slave repositories • Fast sync between repositories, fast checkout • Can be automated with hooks • Useful if you have lots of static files, faster than rsync
  • 53. Read-only filesystem • Design web server that fetch objects directly from the object database • Compact storage, efficient retrieval • Packs of objects also very VM friendly, mmap ready • Some solutions already available OSS
  • 54. Wiki/Ticketing backend • Use git repository as storage for wiki or ticketing systems • Good match for distributed developement • Several solutions already available OSS • ... but similar to SCM usages
  • 55. That’s all folks! • I’ll be around #codebits, feel free to ask me stuff • If you want a git as a SCM demo, lets get organized and I’ll do a impromptu presentation, or even private lapdan^H^H^H^H^Hdemos • After #codebits <{mailto,xmpp}:melo@simplicidade.org
  • 56. About Git http://git-scm.com/ Git Internals: http://peepcode.com/products/git-internals-pdf Git book: http://progit.org/ About Me http://simplicidade.org/notes/ @pedromelo {mailto,xmpp}:melo@simplicidade.org skype:melopt http://github.com/melo http://www.slideshare.net/melopt