SlideShare ist ein Scribd-Unternehmen logo
1 von 78
Downloaden Sie, um offline zu lesen
Git
Understanding




   January 6, 2010




                     Jeff Kunkle
What’s Git?
  Git is a free & open source, distributed version control
 system designed to handle everything from small to very
           large projects with speed and efficiency.


 Every Git clone is a full-fledged repository with complete
history and full revision tracking capabilities, not dependent
   on network access or a central server. Branching and
              merging are fast and easy to do.
Working Directory

      ./


           Rakefile


           init.rb


             lib


              grant.rb
Working Directory

       ./
                          .git
            Rakefile


            init.rb


              lib


               grant.rb


>git init
Working Directory

       ./
                          .git   What’s in here?
            Rakefile


            init.rb


              lib


               grant.rb


>git init
Objects
Git Objects
 header   object_type [content size]0
          content of the file
          can be text
content   can be binary
          can be whatever
                                         Zlib::Deflate
Git Objects
     header   object_type [content size]0
              content of the file
              can be text
    content   can be binary
              can be whatever
                                             Zlib::Deflate

1    Blob     2    Tree            3     Commit      4   Tag
1   Blobs
Working Directory        Git Directory

      ./


           Rakefile


           init.rb


             lib


              grant.rb
Working Directory        Git Directory

       ./


            Rakefile


            init.rb


              lib


               grant.rb

>git add .
>git commit -m “initial commit”
Working Directory        Git Directory

       ./


            Rakefile       blob : 21a307


            init.rb       blob : 644eda


              lib


               grant.rb   blob : a22a24

>git add .
>git commit -m “initial commit”
Working Directory        Git Directory

       ./


            Rakefile       blob : 21a307


            init.rb       blob : 644eda

                                      SHA-1 hashes
              lib
                                      of file content

               grant.rb   blob : a22a24

>git add .
>git commit -m “initial commit”
Blob Content
Blob Content
  %w{ models }.each do |dir|
    path = File.join(File.dirname(__FILE__), 'lib', 'app', dir)
    $LOAD_PATH << path
    ActiveSupport::Dependencies.load_paths << path
    ActiveSupport::Dependencies.load_once_paths.delete(path)
  end




>git cat-file -p 644eda
2   Trees
Working Directory        Git Directory

      ./


           Rakefile        blob : 21a307


           init.rb        blob : 644eda


             lib


              grant.rb    blob : a22a24
Working Directory        Git Directory

      ./                   tree : f2eb1e


           Rakefile        blob : 21a307


           init.rb        blob : 644eda


             lib           tree : 523fa4


              grant.rb    blob : a22a24
Tree Content
Tree Content

  100644 blob 21a30738954b6bb164731d822efafa6c89c7bce7! Rakefile
  100644 blob 644eda506db859e011ccbca5a06421ee76782ac7! init.rb
  040000 tree 523fa41bd27fa29a00afb0bef6a10fde75aef501! lib




>git cat-file -p f2eb1e
Working Directory        Git Directory

      ./                   tree : f2eb1e


           Rakefile        blob : 21a307


           init.rb        blob : 644eda


             lib           tree : 523fa4


              grant.rb    blob : a22a24
Working Directory        Git Directory

      ./                   tree : f2eb1e


           Rakefile        blob : 21a307


           init.rb        blob : 644eda


             lib           tree : 523fa4


              grant.rb    blob : a22a24
3   Commits
Working Directory        Git Directory

      ./                   tree : f2eb1e


           Rakefile        blob : 21a307


           init.rb        blob : 644eda


             lib           tree : 523fa4


              grant.rb    blob : a22a24
Working Directory        Git Directory

      ./                   tree : f2eb1e


           Rakefile        blob : 21a307


           init.rb        blob : 644eda


             lib           tree : 523fa4


              grant.rb    blob : a22a24

                         commit : 3848fa
Commit Content
Commit Content

 tree f2eb1e549e7e0d9cd5b7a580e63e9ce79d5a03ae
 author Jeff Kunkle <jkunkle@nearinfinity.com> 1261341813 -0500
 committer Jeff Kunkle <jkunkle@nearinfinity.com> 1261341813 -0500

 initial commit

                                                    first commit



>git cat-file -p 3848fa
Working Directory        Git Directory

      ./                   tree : f2eb1e


           Rakefile        blob : 21a307


           init.rb        blob : 644eda


             lib           tree : 523fa4


              grant.rb    blob : a22a24

                         commit : 3848fa
Working Directory        Git Directory

      ./                   tree : f2eb1e


           Rakefile        blob : 21a307


           init.rb        blob : 644eda


             lib           tree : 523fa4


              grant.rb    blob : a22a24

                         commit : 3848fa
Commit Content
tree ac451e549e7e0d9cd5b7a580e63e9ce79d5b45a1
parent 3848fa7e91490a99b77590ff1385c4b3eebb3de3
author Jeff Kunkle <jkunkle@nearinfinity.com> 1261351813 -0500
committer Jeff Kunkle <jkunkle@nearinfinity.com> 1261351813 -0500

second commit

                                                   next commit
4   Tags
./                  tree : f2eb1e


     Rakefile        blob : 21a307


     init.rb        blob : 644eda


       lib          tree : 523fa4


        grant.rb    blob : a22a24

                   commit : 3848fa
./                  tree : f2eb1e


            Rakefile        blob : 21a307


            init.rb        blob : 644eda


              lib          tree : 523fa4


               grant.rb    blob : a22a24

                          commit : 3848fa

                            tag : e9eff3
>git tag -a v1.0
Tag Content
Tag Content
 object 3848fa7e91490a99b77590ff1385c4b3eebb3de3
 type commit
 tag v1.0
 tagger Jeff Kunkle <jkunkle@ni.com> Tue Dec 29 21:02:04 2009 -0500

 version 1.0




>git cat-file -p v1.0
./                  tree : f2eb1e


            Rakefile        blob : 21a307


            init.rb        blob : 644eda


              lib          tree : 523fa4


               grant.rb    blob : a22a24

                          commit : 3848fa

                            tag : e9eff3
>git tag -a v1.0
./                  tree : f2eb1e


            Rakefile        blob : 21a307


            init.rb        blob : 644eda


              lib          tree : 523fa4


               grant.rb    blob : a22a24

                          commit : 3848fa

                            tag : e9eff3
>git tag -a v1.0
References
Basic Data Model
        tag


       commit


        tree


        blob
Basic Data Model
        tag


       commit
                Immutable
                Git Objects
        tree


        blob
Basic Data Model
          tag


branch   commit
                  Immutable
                  Git Objects
          tree


          blob
Basic Data Model
          tag


branch   commit
                  Immutable
                  Git Objects
          tree


          blob
Basic Data Model
HEAD      tag


branch   commit
                  Immutable
                  Git Objects
          tree


          blob
Basic Data Model
  HEAD        tag


  branch     commit
                      Immutable
                      Git Objects
 Mutable      tree
References
              blob
Working Directory

      ./


           Rakefile


           init.rb


             lib


              grant.rb
HEAD

branch   tag

commit

 tree    blob

 tree    blob

 blob
HEAD             HEAD

  branch   tag     branch

 commit           commit

   tree    blob     tree

   tree    blob     tree

   blob             blob


>git commit -a lib/grant.rb
HEAD             HEAD     HEAD

  branch   tag     branch   branch

 commit           commit    commit

   tree    blob     tree     tree    blob

   tree    blob     tree             blob

   blob             blob


>git commit -a Rakefile init.rb
Branches
branch   branch


commit


 tree     C1


 blob
master




C     C
master




  C     C




       idea

>git checkout -b idea
master




  C     C


                C




               idea

>git commit
master




  C     C


                C




               idea

>git checkout master
master




  C     C             C


                C




               idea

>git commit
bug

      master




  C     C             C


                C




               idea

>git checkout -b bug
bug

      master

                          C


  C     C             C


                C




               idea

>git commit
bug

      master

                          C


  C     C             C


                C




               idea

>git commit
     checkout master
bug

      master

                          C


  C     C             C


                C




               idea

>git commitbug
     merge
bug

                            master

                      C


  C    C          C           C


            C




           idea

>git commitbug
     merge
bug

                            master

                      C


  C    C          C           C


            C




           idea

>git commitbug bug
     branch
     merge -d
bug

                            master

                      C


  C    C          C           C


            C




           idea

>git commitbugidea
     checkout
     branch
     merge -d bug
bug

                           master

                     C


  C    C       C             C


           C                         C




                                    idea

>git commitbugidea
     checkout
     branch
     merge -d bug
bug

                           master

                     C


  C    C       C             C


           C                        C    C




                                        idea

>git commitbugidea
     checkout
     branch
     merge -d bug
bug

                          master

                      C


  C   C       C             C


          C                        C    C




                                       idea

>git commitbugidea
     checkout bug
     branch
     merge -dmaster
bug

                           master

                       C


  C    C       C             C


           C                        C    C




                                        idea

>git commitbugidea
     checkout
     branch -dmaster
     merge ideabug
bug

                                          master

                       C


  C    C       C           C                C


           C                   C    C




                                   idea

>git commitbugidea
     checkout
     branch -dmaster
     merge ideabug
bug

                                          master

                       C


  C    C       C           C                C


           C                   C    C




                                   idea

>git commitbugidea
     checkout idea
     branch -dmaster
     merge ideabug
Recommendations
Starting new project?
Starting new project?

           Use Git
Using SVN or CVS?
Using SVN or CVS?

   Switch to Git
Using Team Studio?
Using Team Studio?

   Maybe switch to Git
Using MKS?
Using MKS?

   Switch to Git
      or CVS, or Subversion, or anything else
References



Good   Better                             Best
                *most diagrams in this presentation are based on Git internals

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
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
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 

Kürzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
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
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 

Empfohlen

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Empfohlen (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Understanding Git Internals

  • 1. Git Understanding January 6, 2010 Jeff Kunkle
  • 2. What’s Git? Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Branching and merging are fast and easy to do.
  • 3. Working Directory ./ Rakefile init.rb lib grant.rb
  • 4. Working Directory ./ .git Rakefile init.rb lib grant.rb >git init
  • 5. Working Directory ./ .git What’s in here? Rakefile init.rb lib grant.rb >git init
  • 7. Git Objects header object_type [content size]0 content of the file can be text content can be binary can be whatever Zlib::Deflate
  • 8. Git Objects header object_type [content size]0 content of the file can be text content can be binary can be whatever Zlib::Deflate 1 Blob 2 Tree 3 Commit 4 Tag
  • 9. 1 Blobs
  • 10. Working Directory Git Directory ./ Rakefile init.rb lib grant.rb
  • 11. Working Directory Git Directory ./ Rakefile init.rb lib grant.rb >git add . >git commit -m “initial commit”
  • 12. Working Directory Git Directory ./ Rakefile blob : 21a307 init.rb blob : 644eda lib grant.rb blob : a22a24 >git add . >git commit -m “initial commit”
  • 13. Working Directory Git Directory ./ Rakefile blob : 21a307 init.rb blob : 644eda SHA-1 hashes lib of file content grant.rb blob : a22a24 >git add . >git commit -m “initial commit”
  • 15. Blob Content %w{ models }.each do |dir| path = File.join(File.dirname(__FILE__), 'lib', 'app', dir) $LOAD_PATH << path ActiveSupport::Dependencies.load_paths << path ActiveSupport::Dependencies.load_once_paths.delete(path) end >git cat-file -p 644eda
  • 16. 2 Trees
  • 17. Working Directory Git Directory ./ Rakefile blob : 21a307 init.rb blob : 644eda lib grant.rb blob : a22a24
  • 18. Working Directory Git Directory ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24
  • 20. Tree Content 100644 blob 21a30738954b6bb164731d822efafa6c89c7bce7! Rakefile 100644 blob 644eda506db859e011ccbca5a06421ee76782ac7! init.rb 040000 tree 523fa41bd27fa29a00afb0bef6a10fde75aef501! lib >git cat-file -p f2eb1e
  • 21. Working Directory Git Directory ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24
  • 22. Working Directory Git Directory ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24
  • 23. 3 Commits
  • 24. Working Directory Git Directory ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24
  • 25. Working Directory Git Directory ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24 commit : 3848fa
  • 27. Commit Content tree f2eb1e549e7e0d9cd5b7a580e63e9ce79d5a03ae author Jeff Kunkle <jkunkle@nearinfinity.com> 1261341813 -0500 committer Jeff Kunkle <jkunkle@nearinfinity.com> 1261341813 -0500 initial commit first commit >git cat-file -p 3848fa
  • 28. Working Directory Git Directory ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24 commit : 3848fa
  • 29. Working Directory Git Directory ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24 commit : 3848fa
  • 30. Commit Content tree ac451e549e7e0d9cd5b7a580e63e9ce79d5b45a1 parent 3848fa7e91490a99b77590ff1385c4b3eebb3de3 author Jeff Kunkle <jkunkle@nearinfinity.com> 1261351813 -0500 committer Jeff Kunkle <jkunkle@nearinfinity.com> 1261351813 -0500 second commit next commit
  • 31. 4 Tags
  • 32. ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24 commit : 3848fa
  • 33. ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24 commit : 3848fa tag : e9eff3 >git tag -a v1.0
  • 35. Tag Content object 3848fa7e91490a99b77590ff1385c4b3eebb3de3 type commit tag v1.0 tagger Jeff Kunkle <jkunkle@ni.com> Tue Dec 29 21:02:04 2009 -0500 version 1.0 >git cat-file -p v1.0
  • 36. ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24 commit : 3848fa tag : e9eff3 >git tag -a v1.0
  • 37. ./ tree : f2eb1e Rakefile blob : 21a307 init.rb blob : 644eda lib tree : 523fa4 grant.rb blob : a22a24 commit : 3848fa tag : e9eff3 >git tag -a v1.0
  • 39. Basic Data Model tag commit tree blob
  • 40. Basic Data Model tag commit Immutable Git Objects tree blob
  • 41. Basic Data Model tag branch commit Immutable Git Objects tree blob
  • 42. Basic Data Model tag branch commit Immutable Git Objects tree blob
  • 43. Basic Data Model HEAD tag branch commit Immutable Git Objects tree blob
  • 44. Basic Data Model HEAD tag branch commit Immutable Git Objects Mutable tree References blob
  • 45. Working Directory ./ Rakefile init.rb lib grant.rb
  • 46. HEAD branch tag commit tree blob tree blob blob
  • 47. HEAD HEAD branch tag branch commit commit tree blob tree tree blob tree blob blob >git commit -a lib/grant.rb
  • 48. HEAD HEAD HEAD branch tag branch branch commit commit commit tree blob tree tree blob tree blob tree blob blob blob >git commit -a Rakefile init.rb
  • 50. branch branch commit tree C1 blob
  • 51. master C C
  • 52. master C C idea >git checkout -b idea
  • 53. master C C C idea >git commit
  • 54. master C C C idea >git checkout master
  • 55. master C C C C idea >git commit
  • 56. bug master C C C C idea >git checkout -b bug
  • 57. bug master C C C C C idea >git commit
  • 58. bug master C C C C C idea >git commit checkout master
  • 59. bug master C C C C C idea >git commitbug merge
  • 60. bug master C C C C C C idea >git commitbug merge
  • 61. bug master C C C C C C idea >git commitbug bug branch merge -d
  • 62. bug master C C C C C C idea >git commitbugidea checkout branch merge -d bug
  • 63. bug master C C C C C C C idea >git commitbugidea checkout branch merge -d bug
  • 64. bug master C C C C C C C C idea >git commitbugidea checkout branch merge -d bug
  • 65. bug master C C C C C C C C idea >git commitbugidea checkout bug branch merge -dmaster
  • 66. bug master C C C C C C C C idea >git commitbugidea checkout branch -dmaster merge ideabug
  • 67. bug master C C C C C C C C C idea >git commitbugidea checkout branch -dmaster merge ideabug
  • 68. bug master C C C C C C C C C idea >git commitbugidea checkout idea branch -dmaster merge ideabug
  • 72. Using SVN or CVS?
  • 73. Using SVN or CVS? Switch to Git
  • 75. Using Team Studio? Maybe switch to Git
  • 77. Using MKS? Switch to Git or CVS, or Subversion, or anything else
  • 78. References Good Better Best *most diagrams in this presentation are based on Git internals