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

So Help Me God, You Will Understand Git's Model, Even If It Kills Me

So Help Me God, You Will Understand Git's Model, Even If It Kills Me

Scott Robinson

April 25, 2012
Tweet

More Decks by Scott Robinson

Other Decks in Programming

Transcript

  1. 1 2 3 4 6 7 8 9 11 15

    16 10 12 14 5 13 Trunk Branches Merges Tags Discontinued development branch
  2. Trees $ git ls-tree eebc19d60284277eba86620ec828d73d0cdf822a 100644 blob 1377554ebea6f98a2c748183bc5a96852af12ac2 .gitignore 100644

    blob ac1bfdc65a699792310498fc0ba003e61eddf1d0 bad.lua 100644 blob b2f5ce962808f4edd04336eb803b6445b843e052 boom.lua 100644 blob 6b1c0b8946e40ff393f73d80a885fdd39fba93dd bullet.lua 100644 blob 268a04ca259b566c7340d8ba8dab8ce0590e8352 main.lua 100644 blob 67638336f18030013b0bcc7533987a6ba892ba46 rail.lua 040000 tree 415ee50b6cf27815df2750de33b0eac1df8ad814 resources 100644 blob c1a79a49a98c0b3868e33270465121cf40dc622e ship.lua 100644 blob d77c7f1d5fecfc6c998e2eec628495075ba27ec1 wave.lua
  3. Yes, that was a warm up $ find ./.git .

    ./.git ./.git/config ./.git/description ./.git/HEAD ./.git/hooks ... ./.git/info/exclude ./.git/objects/info ./.git/objects/pack ./.git/refs/heads ./.git/refs/tags
  4. What Happens? $ touch xyzzy $ git add xyzzy $

    git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: xyzzy #
  5. You Delete A File And Then Commit It? $ rm

    xyzzy $ git commit -m 'What happens?'
  6. You Can’t Explain That! $ ls $ git status #

    On branch master # Changes not staged for commit: # (use "git add/rm <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # deleted: xyzzy # no changes added to commit (use "git add" and/or "git commit -a") $ git checkout -- xyzzy $ ls xyzzy
  7. Rebase • "your" commit • "their" base commit • their

    most recent ancestor • Replays each of “your” differences upon “their” base