SlideShare a Scribd company logo
Distributed version control with git
— a brief introduction


Joel Krebs
Slides by Oscar Nierstrasz
Why git?
Bob
Bob
      Carol
Bob
        Carol




Alice
          Ted
Bob
                                 Carol




Alice
                                   Ted

        A recipe for disaster!
What is git?
> Distributed revision control system
> Originally developed by Linus Torvalds for the
  development of the Linux Kernel in 2005
> Focus on speed and efficiency
> Quite a unique design and therefore sometimes a bit
  scary and difficult to understand
The git object model
A “blob” is content under
 version control (a file)

          blob
You can have trees of blobs
    (directories of files)

            tree
 blob
            tree
 blob
           blob
A “commit” is a tree of blobs
     (a set of changes)

           commit


            tree
 blob
            tree
 blob
            blob
Most commits modify
                (or merge) earlier
                     commits
                      commit
       commit
                       tree

        tree
                       blob
blob
        tree
blob
        blob
You can “tag” an
interesting commit

        tag
                         commit
                commit
                          tree

                 tree
                          blob
      blob
                 tree
      blob
                 blob
A graph of commits
may belong to a branch   branch

    tag
                         commit
           commit
                          tree

            tree
                          blob
  blob
            tree
  blob
            blob
HEAD
  “HEAD “is the
  current branch
                   branch

  tag
                   commit
         commit
                    tree

          tree
                    blob
blob
          tree
blob
          blob
HEAD


                  branch


                  commit
     commit




Let’s focus on commits
     and branches
Basic git
Create a git repo
                    HEAD

                    master

                     C0
Tell git to “stage”
              changes
HEAD

master

 C0
HEAD

master   Commit your
          changes
 C1

 C0
Collaborating
John                           Jane


Local repo   Public repo   Local repo



                master


                 C1


                 C0
John                            Jane


Local repo   Public repo   Local repo



   master       master        master


    C1           C1            C1


    C0           C0            C0
John                            Jane


Local repo   Public repo   Local repo



   master       master        master


    C2           C1            C3


    C1           C0            C1


    C0                         C0
John                                   Jane


    Local repo          Public repo   Local repo



       master              master        master


        C2                  C1            C3


        C1                  C0            C1


        C0                                C0




(nothing new to pull)
John                            Jane


Local repo   Public repo   Local repo



   master       master        master


    C2           C2            C3


    C1           C1            C1


    C0           C0            C0
John                            Jane


Local repo   Public repo   Local repo



   master       master        master


    C2           C2            C3      C2


    C1           C1            C1


    C0           C0            C0
John                                Jane


Local repo    Public repo      Local repo



   master        master           master


    C2            C2               C4


    C1            C1               C3      C2


    C0            C0               C1


                                   C0




             NB: git pull = fetch + merge
John                               Jane


Local repo   Public repo      Local repo



   master       master           master


    C2           C4               C4


    C1           C3      C2       C3      C2


    C0           C1               C1


                 C0               C0
John                                   Jane


Local repo       Public repo      Local repo



   master           master           master


    C4               C4               C4


    C3      C2       C3      C2       C3      C2


    C1               C1               C1


    C0               C0               C0
Branching
and merging
“origin” refers to the
                    remote repo


   HEAD

   master

origin/master

     C1

     C0
HEAD

                master

origin/master    C2

                 C1

                 C0
HEAD
                         tryout
                master

origin/master    C2

                 C1

                 C0
HEAD

                          tryout
                master

origin/master    C2

                 C1      NB: git checkout –b … =
                            branch + checkout
                 C0
HEAD

                         tryout
                master
                          C3
origin/master    C2

                 C1

                 C0
HEAD

         tryout
master
          C3      C5
 C2
                       origin/master
 C1       C4      C6

 C0                    origin/idea
HEAD

              tryout

               C7
master
         C3    C5
 C2
                       origin/master
 C1      C4    C6

 C0                    origin/idea
tryout
HEAD
               C7
master
         C3    C5
 C2
                       origin/master
 C1      C4    C6

 C0                    origin/idea
HEAD
              tryout
master
               C7
 C8
         C3    C5
 C2
                       origin/master
 C1      C4    C6

 C0                    origin/idea
HEAD
                              tryout
                master
                               C7
origin/master    C8
                         C3    C5
                 C2

                 C1      C4    C6

                 C0                    origin/idea
Overview git workflow



               Remote repository
                  fetch               push
                          Local repository
        pull                          commit
               checkout      Index (cache)
               HEAD                   add
                Working directory
Getting started
First steps

> Follow instructions on P2 Blog for installation
> Send your ssh public key to joel.krebs@students.unibe.ch
> Create meaningful commits with according messages
> Hints that make your life easier:
  —Create a .gitignore file
  —Always pull before you push
  —Don’t panic when merge conflicts occur
More to git
More to git …



> Merging and mergetool
> Squashing commits when merging
> Resolving conflicts
> User authentication with ssh
> gitx and other graphical tools
> git configure — remembering your name
> git remote — multiple remote repos
> github — an open source public repo
> …
Resources



   http://git-scm.com/                  http://book.git-scm.com/index.html



                 http://gitready.com/



                                   https://github.com/




http://www.slideshare.net/chacon/getting-git             http://oreilly.com/
http://creativecommons.org/licenses/by-sa/3.0/
Ad

More Related Content

What's hot (20)

Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
Nick Quaranto
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
Md Swawibe Ul Alam
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
Fran García
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用
Will Huang
 
Git workflows
Git workflowsGit workflows
Git workflows
Xpand IT
 
Git 입문자를 위한 가이드
Git 입문자를 위한 가이드Git 입문자를 위한 가이드
Git 입문자를 위한 가이드
chandler0201
 
Git
GitGit
Git
Mayank Patel
 
Learning git
Learning gitLearning git
Learning git
Sid Anand
 
Git real slides
Git real slidesGit real slides
Git real slides
Lucas Couto
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
abodeltae
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
Randal Schwartz
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Lukas Fittl
 
Git and GitFlow branching model
Git and GitFlow branching modelGit and GitFlow branching model
Git and GitFlow branching model
Pavlo Hodysh
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
Git commands
Git commandsGit commands
Git commands
Viyaan Jhiingade
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
Md. Ahsan Habib Nayan
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
Sage Sharp
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
Pham Quy (Jack)
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
Panagiotis Papadopoulos
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
Naveen Pandey
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
Nick Quaranto
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
Md Swawibe Ul Alam
 
git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用git merge 與 rebase 的觀念與實務應用
git merge 與 rebase 的觀念與實務應用
Will Huang
 
Git workflows
Git workflowsGit workflows
Git workflows
Xpand IT
 
Git 입문자를 위한 가이드
Git 입문자를 위한 가이드Git 입문자를 위한 가이드
Git 입문자를 위한 가이드
chandler0201
 
Learning git
Learning gitLearning git
Learning git
Sid Anand
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
abodeltae
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Lukas Fittl
 
Git and GitFlow branching model
Git and GitFlow branching modelGit and GitFlow branching model
Git and GitFlow branching model
Pavlo Hodysh
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
Sage Sharp
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
Naveen Pandey
 

Viewers also liked (9)

Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
HubSpot
 
Git basic
Git basicGit basic
Git basic
Emran Ul Hadi
 
Best Practices in Exception Handling
Best Practices in Exception HandlingBest Practices in Exception Handling
Best Practices in Exception Handling
Lemi Orhan Ergin
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
Sven Peters
 
Git 사용 가이드
Git 사용 가이드Git 사용 가이드
Git 사용 가이드
도형 임
 
svn 능력자를 위한 git 개념 가이드
svn 능력자를 위한 git 개념 가이드svn 능력자를 위한 git 개념 가이드
svn 능력자를 위한 git 개념 가이드
Insub Lee
 
Git는 머꼬? GitHub는 또 머지?
Git는 머꼬? GitHub는 또 머지?Git는 머꼬? GitHub는 또 머지?
Git는 머꼬? GitHub는 또 머지?
Ian Choi
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guide
Rohit Arora
 
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
민태 김
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
HubSpot
 
Best Practices in Exception Handling
Best Practices in Exception HandlingBest Practices in Exception Handling
Best Practices in Exception Handling
Lemi Orhan Ergin
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
Sven Peters
 
Git 사용 가이드
Git 사용 가이드Git 사용 가이드
Git 사용 가이드
도형 임
 
svn 능력자를 위한 git 개념 가이드
svn 능력자를 위한 git 개념 가이드svn 능력자를 위한 git 개념 가이드
svn 능력자를 위한 git 개념 가이드
Insub Lee
 
Git는 머꼬? GitHub는 또 머지?
Git는 머꼬? GitHub는 또 머지?Git는 머꼬? GitHub는 또 머지?
Git는 머꼬? GitHub는 또 머지?
Ian Choi
 
Introduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guideIntroduction to Git/Github - A beginner's guide
Introduction to Git/Github - A beginner's guide
Rohit Arora
 
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
버전관리를 들어본적 없는 사람들을 위한 DVCS - Git
민태 김
 
Ad

Similar to Quick Introduction to git (8)

Git社内勉強会
Git社内勉強会Git社内勉強会
Git社内勉強会
Hirata Daichi
 
Understanding git
Understanding gitUnderstanding git
Understanding git
Avik Das
 
M.Mozūras - git
M.Mozūras - gitM.Mozūras - git
M.Mozūras - git
Agile Lietuva
 
Git data model
Git data modelGit data model
Git data model
Lin Liu
 
GIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersjiGIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersji
3camp
 
Let the contribution begin
Let the contribution beginLet the contribution begin
Let the contribution begin
SeongJae Park
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETIC
La FeWeb
 
Git Going with DVCS v1.6.0
Git Going with DVCS v1.6.0Git Going with DVCS v1.6.0
Git Going with DVCS v1.6.0
Matthew McCullough
 
Understanding git
Understanding gitUnderstanding git
Understanding git
Avik Das
 
Git data model
Git data modelGit data model
Git data model
Lin Liu
 
GIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersjiGIT rozproszony system kontroli wersji
GIT rozproszony system kontroli wersji
3camp
 
Let the contribution begin
Let the contribution beginLet the contribution begin
Let the contribution begin
SeongJae Park
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETIC
La FeWeb
 
Ad

Recently uploaded (20)

BuzzerSaarang IITM Chennai Finals Quiz.pptx
BuzzerSaarang IITM Chennai Finals Quiz.pptxBuzzerSaarang IITM Chennai Finals Quiz.pptx
BuzzerSaarang IITM Chennai Finals Quiz.pptx
gabssienna0o
 
10 Best IPTV Free Trials in 2025 (Try Before You Buy).pdf
10 Best IPTV Free Trials in 2025 (Try Before You Buy).pdf10 Best IPTV Free Trials in 2025 (Try Before You Buy).pdf
10 Best IPTV Free Trials in 2025 (Try Before You Buy).pdf
BEST IPTV
 
Introduction to the SAT preaparation.pptx
Introduction to the SAT preaparation.pptxIntroduction to the SAT preaparation.pptx
Introduction to the SAT preaparation.pptx
vikashthakur62
 
Environmental_Footprint_LCA_Project_Creative.pptx
Environmental_Footprint_LCA_Project_Creative.pptxEnvironmental_Footprint_LCA_Project_Creative.pptx
Environmental_Footprint_LCA_Project_Creative.pptx
shahbaz78678678678
 
Understanding Rich Messaging Services Enhancing Communication in the Digital ...
Understanding Rich Messaging Services Enhancing Communication in the Digital ...Understanding Rich Messaging Services Enhancing Communication in the Digital ...
Understanding Rich Messaging Services Enhancing Communication in the Digital ...
Times Mobile
 
Best IPTV Provider 2025 Top 5 Ranked IPTV Subscriptions.pdf
Best IPTV Provider 2025 Top 5 Ranked IPTV Subscriptions.pdfBest IPTV Provider 2025 Top 5 Ranked IPTV Subscriptions.pdf
Best IPTV Provider 2025 Top 5 Ranked IPTV Subscriptions.pdf
MimounKhamhand1
 
mr discrimination________________________________________________________.pdf
mr discrimination________________________________________________________.pdfmr discrimination________________________________________________________.pdf
mr discrimination________________________________________________________.pdf
Leonid Ledata
 
Millie Bobby Brown Life Biography The Celeb Post
Millie Bobby Brown Life Biography The Celeb PostMillie Bobby Brown Life Biography The Celeb Post
Millie Bobby Brown Life Biography The Celeb Post
Lionapk
 
ch11.pptKGYUTFYDRERLJIOUY7T867RVHOJIP09-IU08Y7GTFGYU890-I90UIYGUI
ch11.pptKGYUTFYDRERLJIOUY7T867RVHOJIP09-IU08Y7GTFGYU890-I90UIYGUIch11.pptKGYUTFYDRERLJIOUY7T867RVHOJIP09-IU08Y7GTFGYU890-I90UIYGUI
ch11.pptKGYUTFYDRERLJIOUY7T867RVHOJIP09-IU08Y7GTFGYU890-I90UIYGUI
Abodahab
 
mr discrimination________________________________________________________1111...
mr discrimination________________________________________________________1111...mr discrimination________________________________________________________1111...
mr discrimination________________________________________________________1111...
Leonid Ledata
 
Khloé Kardashian Biography The Celeb Post
Khloé Kardashian Biography The Celeb PostKhloé Kardashian Biography The Celeb Post
Khloé Kardashian Biography The Celeb Post
Lionapk
 
A Hypothetical ad for ether a Video Game, TV show, Movie.
A Hypothetical ad for ether a Video Game, TV show,  Movie.A Hypothetical ad for ether a Video Game, TV show,  Movie.
A Hypothetical ad for ether a Video Game, TV show, Movie.
skylarleakeybusiness
 
Pension-Rules-1-2021040512 0919.ppt
Pension-Rules-1-2021040512      0919.pptPension-Rules-1-2021040512      0919.ppt
Pension-Rules-1-2021040512 0919.ppt
SwathyKrishna55
 
Ross_12e_PPTjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj_Ch07.pptx
Ross_12e_PPTjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj_Ch07.pptxRoss_12e_PPTjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj_Ch07.pptx
Ross_12e_PPTjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj_Ch07.pptx
ssuseradbe2d
 
Adapting to Change_ How Los Angeles' TV Industry is Evolving by David Shane P...
Adapting to Change_ How Los Angeles' TV Industry is Evolving by David Shane P...Adapting to Change_ How Los Angeles' TV Industry is Evolving by David Shane P...
Adapting to Change_ How Los Angeles' TV Industry is Evolving by David Shane P...
David Shane PR
 
Travis Kelce Life Biography The Celeb Post
Travis Kelce Life Biography The Celeb PostTravis Kelce Life Biography The Celeb Post
Travis Kelce Life Biography The Celeb Post
Lionapk
 
mr discrimination________________________________________________________1111...
mr discrimination________________________________________________________1111...mr discrimination________________________________________________________1111...
mr discrimination________________________________________________________1111...
Leonid Ledata
 
1883 Season 2_ What’s Really Going On With the Yellowstone Prequel.docx
1883 Season 2_ What’s Really Going On With the Yellowstone Prequel.docx1883 Season 2_ What’s Really Going On With the Yellowstone Prequel.docx
1883 Season 2_ What’s Really Going On With the Yellowstone Prequel.docx
voice ofarticle
 
The Psychology of Scene Transitions - Mark Murphy Director
The Psychology of Scene Transitions - Mark Murphy DirectorThe Psychology of Scene Transitions - Mark Murphy Director
The Psychology of Scene Transitions - Mark Murphy Director
Mark Murphy Director
 
Project Management Infographics by Slidesgo.pptx
Project Management Infographics by Slidesgo.pptxProject Management Infographics by Slidesgo.pptx
Project Management Infographics by Slidesgo.pptx
mtacilladiaz
 
BuzzerSaarang IITM Chennai Finals Quiz.pptx
BuzzerSaarang IITM Chennai Finals Quiz.pptxBuzzerSaarang IITM Chennai Finals Quiz.pptx
BuzzerSaarang IITM Chennai Finals Quiz.pptx
gabssienna0o
 
10 Best IPTV Free Trials in 2025 (Try Before You Buy).pdf
10 Best IPTV Free Trials in 2025 (Try Before You Buy).pdf10 Best IPTV Free Trials in 2025 (Try Before You Buy).pdf
10 Best IPTV Free Trials in 2025 (Try Before You Buy).pdf
BEST IPTV
 
Introduction to the SAT preaparation.pptx
Introduction to the SAT preaparation.pptxIntroduction to the SAT preaparation.pptx
Introduction to the SAT preaparation.pptx
vikashthakur62
 
Environmental_Footprint_LCA_Project_Creative.pptx
Environmental_Footprint_LCA_Project_Creative.pptxEnvironmental_Footprint_LCA_Project_Creative.pptx
Environmental_Footprint_LCA_Project_Creative.pptx
shahbaz78678678678
 
Understanding Rich Messaging Services Enhancing Communication in the Digital ...
Understanding Rich Messaging Services Enhancing Communication in the Digital ...Understanding Rich Messaging Services Enhancing Communication in the Digital ...
Understanding Rich Messaging Services Enhancing Communication in the Digital ...
Times Mobile
 
Best IPTV Provider 2025 Top 5 Ranked IPTV Subscriptions.pdf
Best IPTV Provider 2025 Top 5 Ranked IPTV Subscriptions.pdfBest IPTV Provider 2025 Top 5 Ranked IPTV Subscriptions.pdf
Best IPTV Provider 2025 Top 5 Ranked IPTV Subscriptions.pdf
MimounKhamhand1
 
mr discrimination________________________________________________________.pdf
mr discrimination________________________________________________________.pdfmr discrimination________________________________________________________.pdf
mr discrimination________________________________________________________.pdf
Leonid Ledata
 
Millie Bobby Brown Life Biography The Celeb Post
Millie Bobby Brown Life Biography The Celeb PostMillie Bobby Brown Life Biography The Celeb Post
Millie Bobby Brown Life Biography The Celeb Post
Lionapk
 
ch11.pptKGYUTFYDRERLJIOUY7T867RVHOJIP09-IU08Y7GTFGYU890-I90UIYGUI
ch11.pptKGYUTFYDRERLJIOUY7T867RVHOJIP09-IU08Y7GTFGYU890-I90UIYGUIch11.pptKGYUTFYDRERLJIOUY7T867RVHOJIP09-IU08Y7GTFGYU890-I90UIYGUI
ch11.pptKGYUTFYDRERLJIOUY7T867RVHOJIP09-IU08Y7GTFGYU890-I90UIYGUI
Abodahab
 
mr discrimination________________________________________________________1111...
mr discrimination________________________________________________________1111...mr discrimination________________________________________________________1111...
mr discrimination________________________________________________________1111...
Leonid Ledata
 
Khloé Kardashian Biography The Celeb Post
Khloé Kardashian Biography The Celeb PostKhloé Kardashian Biography The Celeb Post
Khloé Kardashian Biography The Celeb Post
Lionapk
 
A Hypothetical ad for ether a Video Game, TV show, Movie.
A Hypothetical ad for ether a Video Game, TV show,  Movie.A Hypothetical ad for ether a Video Game, TV show,  Movie.
A Hypothetical ad for ether a Video Game, TV show, Movie.
skylarleakeybusiness
 
Pension-Rules-1-2021040512 0919.ppt
Pension-Rules-1-2021040512      0919.pptPension-Rules-1-2021040512      0919.ppt
Pension-Rules-1-2021040512 0919.ppt
SwathyKrishna55
 
Ross_12e_PPTjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj_Ch07.pptx
Ross_12e_PPTjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj_Ch07.pptxRoss_12e_PPTjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj_Ch07.pptx
Ross_12e_PPTjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj_Ch07.pptx
ssuseradbe2d
 
Adapting to Change_ How Los Angeles' TV Industry is Evolving by David Shane P...
Adapting to Change_ How Los Angeles' TV Industry is Evolving by David Shane P...Adapting to Change_ How Los Angeles' TV Industry is Evolving by David Shane P...
Adapting to Change_ How Los Angeles' TV Industry is Evolving by David Shane P...
David Shane PR
 
Travis Kelce Life Biography The Celeb Post
Travis Kelce Life Biography The Celeb PostTravis Kelce Life Biography The Celeb Post
Travis Kelce Life Biography The Celeb Post
Lionapk
 
mr discrimination________________________________________________________1111...
mr discrimination________________________________________________________1111...mr discrimination________________________________________________________1111...
mr discrimination________________________________________________________1111...
Leonid Ledata
 
1883 Season 2_ What’s Really Going On With the Yellowstone Prequel.docx
1883 Season 2_ What’s Really Going On With the Yellowstone Prequel.docx1883 Season 2_ What’s Really Going On With the Yellowstone Prequel.docx
1883 Season 2_ What’s Really Going On With the Yellowstone Prequel.docx
voice ofarticle
 
The Psychology of Scene Transitions - Mark Murphy Director
The Psychology of Scene Transitions - Mark Murphy DirectorThe Psychology of Scene Transitions - Mark Murphy Director
The Psychology of Scene Transitions - Mark Murphy Director
Mark Murphy Director
 
Project Management Infographics by Slidesgo.pptx
Project Management Infographics by Slidesgo.pptxProject Management Infographics by Slidesgo.pptx
Project Management Infographics by Slidesgo.pptx
mtacilladiaz
 

Quick Introduction to git

  • 1. Distributed version control with git — a brief introduction Joel Krebs Slides by Oscar Nierstrasz
  • 3. Bob
  • 4. Bob Carol
  • 5. Bob Carol Alice Ted
  • 6. Bob Carol Alice Ted A recipe for disaster!
  • 8. > Distributed revision control system > Originally developed by Linus Torvalds for the development of the Linux Kernel in 2005 > Focus on speed and efficiency > Quite a unique design and therefore sometimes a bit scary and difficult to understand
  • 10. A “blob” is content under version control (a file) blob
  • 11. You can have trees of blobs (directories of files) tree blob tree blob blob
  • 12. A “commit” is a tree of blobs (a set of changes) commit tree blob tree blob blob
  • 13. Most commits modify (or merge) earlier commits commit commit tree tree blob blob tree blob blob
  • 14. You can “tag” an interesting commit tag commit commit tree tree blob blob tree blob blob
  • 15. A graph of commits may belong to a branch branch tag commit commit tree tree blob blob tree blob blob
  • 16. HEAD “HEAD “is the current branch branch tag commit commit tree tree blob blob tree blob blob
  • 17. HEAD branch commit commit Let’s focus on commits and branches
  • 19. Create a git repo HEAD master C0
  • 20. Tell git to “stage” changes HEAD master C0
  • 21. HEAD master Commit your changes C1 C0
  • 23. John Jane Local repo Public repo Local repo master C1 C0
  • 24. John Jane Local repo Public repo Local repo master master master C1 C1 C1 C0 C0 C0
  • 25. John Jane Local repo Public repo Local repo master master master C2 C1 C3 C1 C0 C1 C0 C0
  • 26. John Jane Local repo Public repo Local repo master master master C2 C1 C3 C1 C0 C1 C0 C0 (nothing new to pull)
  • 27. John Jane Local repo Public repo Local repo master master master C2 C2 C3 C1 C1 C1 C0 C0 C0
  • 28. John Jane Local repo Public repo Local repo master master master C2 C2 C3 C2 C1 C1 C1 C0 C0 C0
  • 29. John Jane Local repo Public repo Local repo master master master C2 C2 C4 C1 C1 C3 C2 C0 C0 C1 C0 NB: git pull = fetch + merge
  • 30. John Jane Local repo Public repo Local repo master master master C2 C4 C4 C1 C3 C2 C3 C2 C0 C1 C1 C0 C0
  • 31. John Jane Local repo Public repo Local repo master master master C4 C4 C4 C3 C2 C3 C2 C3 C2 C1 C1 C1 C0 C0 C0
  • 33. “origin” refers to the remote repo HEAD master origin/master C1 C0
  • 34. HEAD master origin/master C2 C1 C0
  • 35. HEAD tryout master origin/master C2 C1 C0
  • 36. HEAD tryout master origin/master C2 C1 NB: git checkout –b … = branch + checkout C0
  • 37. HEAD tryout master C3 origin/master C2 C1 C0
  • 38. HEAD tryout master C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
  • 39. HEAD tryout C7 master C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
  • 40. tryout HEAD C7 master C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
  • 41. HEAD tryout master C7 C8 C3 C5 C2 origin/master C1 C4 C6 C0 origin/idea
  • 42. HEAD tryout master C7 origin/master C8 C3 C5 C2 C1 C4 C6 C0 origin/idea
  • 43. Overview git workflow Remote repository fetch push Local repository pull commit checkout Index (cache) HEAD add Working directory
  • 45. First steps > Follow instructions on P2 Blog for installation > Send your ssh public key to [email protected] > Create meaningful commits with according messages > Hints that make your life easier: —Create a .gitignore file —Always pull before you push —Don’t panic when merge conflicts occur
  • 47. More to git … > Merging and mergetool > Squashing commits when merging > Resolving conflicts > User authentication with ssh > gitx and other graphical tools > git configure — remembering your name > git remote — multiple remote repos > github — an open source public repo > …
  • 48. Resources http://git-scm.com/ http://book.git-scm.com/index.html http://gitready.com/ https://github.com/ http://www.slideshare.net/chacon/getting-git http://oreilly.com/