Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Git et la théorie des graph

Git et la théorie des graph

ubermuda

June 24, 2014
Tweet

More Decks by ubermuda

Other Decks in Programming

Transcript

  1. Git et la théorie des graphs
    Geoffrey Bachelet – @ubermuda
    All your rebase are belong to us

    View full-size slide

  2. Freelance
    Symfony2
    Devops
    @ubermuda
    Auteur
    Développeur
    Formateur

    View full-size slide

  3. La théorie des graphs

    View full-size slide

  4. Seven bridges of Königsberg

    View full-size slide

  5. Seven bridges of Königsberg
    Traverser chaque pont de Königsberg
    Une et une seule fois

    View full-size slide

  6. Leonhard Euler
    lol noobs.

    View full-size slide

  7. http://fr.wikipedia.org/wiki/Probl%C3%A8me_des_sept_ponts_de_K%C3%B6nigsberg

    View full-size slide

  8. http://fr.wikipedia.org/wiki/Probl%C3%A8me_des_sept_ponts_de_K%C3%B6nigsberg
    graph

    View full-size slide

  9. Un graphe est une collection d'éléments mis en relation entre eux.
    !
    ...
    !
    Selon que l'on choisit d'orienter les arêtes ou de leur attribuer un
    poids (un coût de passage), on parle de graphes orientés ou de
    graphes pondérés.
    http://www.futura-sciences.com/magazines/mathematiques/infos/dico/d/mathematiques-theorie-graphes-4712/
    www.futura-sciences.com
    Définition

    View full-size slide

  10. Git ?!?!?!?!

    View full-size slide

  11. A B E
    D
    C
    Noeuds

    View full-size slide

  12. A B E
    D
    C
    Arêtes

    View full-size slide

  13. A B E
    D
    C
    Graph orienté

    View full-size slide

  14. A B E
    D
    C
    Graph orienté

    View full-size slide

  15. Atteignabilité
    (reachability)

    View full-size slide

  16. A B E
    D
    C
    Atteignabilité

    View full-size slide

  17. Atteignabilité
    C est atteignable depuis E
    A B E
    D
    C

    View full-size slide

  18. Atteignabilité
    NOPE
    A B E
    D
    C

    View full-size slide

  19. A B
    D
    E
    C
    Atteignabilité
    F

    View full-size slide

  20. A B
    D
    E
    C
    Atteignabilité
    F
    D n'est pas atteignable depuis F

    View full-size slide

  21. Atteignabilité

    View full-size slide

  22. Qu'est-ce qu'une branche ?

    View full-size slide

  23. $  ls  .git/refs/heads/  
    master  
    !
    $  cat  .git/refs/heads/master  
    58bd01cded7904f1596cb12aac1d3e0e8ae6b558

    View full-size slide

  24. $  git  log  -­‐-­‐format="%H"  
    6465a2cd4d6d3b0a0a62588eeb5b798bb7d31a71  
    7d1d4dabc49854a0807200361731446476565094  
    17a59ceda9b2806e2a135df039506d1ec1a976e6  
    ...

    View full-size slide

  25. $  echo  "6465a2cd4d6d3b0a0a62588eeb5b798bb7d31a71"  \  
      >  .git/refs/heads/foo

    View full-size slide

  26. $  git  branch  
    *  master  
       foo

    View full-size slide

  27. $  git  branch  
    *  master  
       foo

    View full-size slide

  28. A B
    D
    E
    C
    F
    master
    foo

    View full-size slide

  29. A B
    D
    E
    C
    F
    master
    foo
    Atteignabilité !

    View full-size slide

  30. Qu'est-ce qu'un merge ?

    View full-size slide

  31. A B
    D
    E
    C
    F
    master
    foo
    $  git  merge  master  foo

    View full-size slide

  32. A B
    D
    E
    C
    F
    master
    foo
    Atteignabilité !
    G

    View full-size slide

  33. fast-forward ?

    View full-size slide

  34. A B C E
    D
    origin/master
    master
    F

    View full-size slide

  35. A B C E
    D
    origin/master
    master
    F
    $  git  merge  origin/master
    Atteignable !

    View full-size slide

  36. C E
    D
    origin/master
    master
    F
    master
    $  git  merge  origin/master
    A B

    View full-size slide

  37. cherry-pick ?

    View full-size slide

  38. A B
    D
    E
    C
    F
    master
    foo
    $  git  checkout  foo  
    $  git  cherry  pick  F

    View full-size slide

  39. master
    foo
    F'
    $  git  checkout  foo  
    $  git  cherry  pick  F
    A B
    D
    E
    C
    F
    master
    foo

    View full-size slide

  40. $  git  checkout  foo  
    $  git  rebase  master
    A B
    D
    E
    C
    F
    master
    foo

    View full-size slide

  41. B
    merge base
    $  git  checkout  foo  
    $  git  rebase  master
    A
    D
    E
    C
    F
    master
    foo

    View full-size slide

  42. merge base
    !
    premier ancêtre commun

    View full-size slide

  43. A B
    D
    E
    C
    F
    master
    foo
    Atteignable !

    View full-size slide

  44. A B
    D
    E
    C
    F
    master
    foo
    C'
    $  git  checkout  foo  
    $  git  rebase  master

    View full-size slide

  45. A B
    D
    E
    C
    F
    master
    foo
    C' D'
    $  git  checkout  foo  
    $  git  rebase  master

    View full-size slide

  46. A B
    D
    E
    C
    F
    master
    foo
    C' D'
    foo
    $  git  checkout  foo  
    $  git  rebase  master

    View full-size slide

  47. A B
    D
    E
    C
    F
    master
    C' D'
    foo
    ???
    $  git  checkout  foo  
    $  git  rebase  master

    View full-size slide

  48. A B
    D
    E
    C
    F
    master
    C' D'
    foo
    Headless
    $  git  checkout  foo  
    $  git  rebase  master

    View full-size slide

  49. Headless
    non-atteignable depuis une référence
    susceptible d'être "garbage collecté"

    View full-size slide

  50. A B
    D
    E
    C
    F
    master
    C' D'
    foo
    $  git  reset  -­‐-­‐hard  D
    foo
    A B
    D
    E
    C
    F C' D'

    View full-size slide

  51. A B C D
    master
    A B
    master
    origin
    local
    origin/master

    View full-size slide

  52. A B C D
    master
    A B
    master
    origin
    local
    C D
    origin/master
    FETCH !

    View full-size slide

  53. A B C D
    master
    A B
    master
    origin
    local
    C D
    origin/master

    View full-size slide

  54. A B C
    master
    A B
    master
    origin
    local
    D

    View full-size slide

  55. A B C
    master
    A B
    master
    origin
    local
    D
    D

    View full-size slide

  56. A B C
    master
    A B
    master
    origin
    local
    D
    D
    A B C
    master
    A B
    master
    D
    D

    View full-size slide

  57. A B C
    master
    A B
    master
    origin
    local
    D
    D
    A B C
    master
    A B
    master
    D
    D
    NOPE

    View full-size slide

  58. Geoffrey Bachelet – @ubermuda
    http:/
    /stage1.io/
    https://speackerdeck.com/ubermuda/git-et-la-theorie-des-graph

    View full-size slide