Deeper look into_git

  • Published on
    25-Jul-2015

  • View
    92

  • Download
    0

Embed Size (px)

Transcript

<ul><li><p>A deeper look into</p><p>HumanTalks Grenoble 11 Fvrier 20131Thursday, 19 June 14</p></li><li><p>About me</p><p>@sabativi</p><p>Grenoble Startup Digest Curator</p><p>Developer at Sogilis</p><p>2Thursday, 19 June 14</p></li><li><p>DISCLAIMER</p><p>http://www.jayway.com/author/philipnilsson/</p><p>3Thursday, 19 June 14</p></li><li><p>Decentralized version control like Git has a lot of </p><p>momentum right now</p><p>4Thursday, 19 June 14</p></li><li><p>STOP COMPARING SVN AND GIT</p><p>5Thursday, 19 June 14</p></li><li><p>Talk about git asA purely functional data </p><p>structure</p><p>6Thursday, 19 June 14</p></li><li><p>Preliminiaries</p><p>7Thursday, 19 June 14</p></li><li><p>A functional data structure is essentially an immutable </p><p>data structure: its values never change.</p><p>8Thursday, 19 June 14</p></li><li><p>Example : A simple list</p><p>Lets consider L: [ 3, 2, 1 ]</p><p>Lets do operation INSERT(4) at the front</p><p>If L is mutable then L: [ 4, 3, 2, 1 ]</p><p>9Thursday, 19 June 14</p></li><li><p> +---+ +---+ +---+ +---+ | 4 +---&gt;+ 3 +---&gt;+ 2 +---&gt;+ 1 | +---+ +---+ +---+ +---+ | |new list original</p><p>Immutable</p><p> +---+ +---+ +---+ +---+new list 1 -&gt; | 4 +---+-&gt;+ 3 +---&gt;+ 2 +---&gt;+ 1 | +---+ / +---+ +---+ +---+ / | +---+/ originalnew list 2 -&gt; | 9 + +---+</p><p>10Thursday, 19 June 14</p></li><li><p>Immutable</p><p> +---+ +---+updated list -&gt; | 4 +---&gt;+ 5 +----+ +---+ +---+ \ \ +---+ +---+ +-+-+ +---+ new list 1 -&gt; | 4 +---&gt;+ 3 +---&gt;+ 2 +---&gt;+ 1 | +---+ / +---+ +---+ +---+ / | +---+/ original new list 2 -&gt; | 9 + +---+</p><p>11Thursday, 19 June 14</p></li><li><p>GIT VS PURELY FUNCTIONAL DATA</p><p>To update our code base with new versions, keeping old versions available.</p><p>Collaborating on a single code base without updates interferingwith each other in an unpredicable way.</p><p>Update data structure while keeping the old value of that data available.</p><p>Updating a structure in one place without interfering with someone elses updates of that structure.</p><p>12Thursday, 19 June 14</p></li><li><p>Git basically is a purely functional data structure, </p><p>with a command line client that allows you to perform operations on it.</p><p>13Thursday, 19 June 14</p></li><li><p>Lets say we have a repository containing commits A, B and C in that order, in the master </p><p>branch. Weve told Git to store the entirestate of our working directory three times </p><p>during development.We can represent this state of development as </p><p>the history [C,B,A]</p><p>+---+ +---+ +---++ C +---&gt;+ B +---&gt;+ A |+---+ +---+ +---+ |master</p><p>14Thursday, 19 June 14</p></li><li><p>Commiting</p><p>+---+ +---+ +---+ +---++ D +---&gt;+ C +---&gt;+ B +---&gt;+ A |+---+ +---+ +---+ +---+ | |master master^</p><p>git commit</p><p>15Thursday, 19 June 14</p></li><li><p>Amending</p><p> +---+ +---+ +---+ +---+ef4d34 -&gt; | D +--+&gt;+ C +---&gt;+ B +---&gt;+ A | +---+ / +---+ +---+ +---+ / | +---+ master^master -&gt; | E | +---+</p><p>git commit --amend</p><p>16Thursday, 19 June 14</p></li><li><p>Branching</p><p> +---+ +---+ +---+ +---+branch -&gt; | D +--+&gt;+ C +---&gt;+ B +---&gt;+ A | +---+ / +---+ +---+ +---+ / | +---+ master^master -&gt; | E | +---+</p><p>git checkout -b</p><p>17Thursday, 19 June 14</p></li><li><p>RebasingWe want to update the commit C with a new </p><p>commit message</p><p> +---+ +---+rebased -&gt;| D'+---&gt;+ C'+ +---+ +---+\ \ +---+ +---+ \ +---+ +---+branch -&gt; | D +--+&gt;+ C +---&gt;+ B +---&gt;+ A | +---+ / +---+ +---+ +---+ / | +---+ master^master -&gt; | E | +---+</p><p>git rebase18Thursday, 19 June 14</p></li><li><p>Merging</p><p>Merging introduces a bit more complexity to our model. Instead of our history being a tree, it is now an acyclic </p><p>graph.</p><p> +---+ --+ X |+---+/ +---+| M |+---+\ +---+ --+ Y | +---+</p><p>git merge19Thursday, 19 June 14</p></li><li><p>Conclusion</p><p>20Thursday, 19 June 14</p></li><li><p>MERCI !!</p><p>21Thursday, 19 June 14</p></li></ul>