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

Doctor Gitlove

globaldev
November 28, 2013

Doctor Gitlove

...or: How I Learned to Stop Worrying and Love Git Rebase

In this talk Paul Bowsher gives some insight into how Git works under-the-hood, so next time you find yourself in some horrible rebase state it's not so scary; you know where it's actually stuck. He explores the different types of object used within git's database and how they all link together to form your git history.

Find the video of the talk at http://vimeo.com/80789852

globaldev

November 28, 2013
Tweet

Other Decks in Programming

Transcript

  1. Git SVN • Own local repository • SHA commit refs

    • Commit to local • Push to remote • Branches are references • master • Central repository • Sequential commit #s • Commit to remote ! • Branches are directories • trunk
  2. Objects • Referred to by SHA-1 of their contents •

    Blob • Tree • Commit • Tag • Immutable
  3. git push git fetch • Synchronises object database • blobs,

    trees, commits, tags • Synchronises remote references • fetch namespaces: origin/master • push fast-forwards •git push --tags
  4. Reset •--hard • Resets all including working copy •--mixed (default)

    • Resets all excluding working copy •--soft (git commit --amend) • Resets commit only
  5. git up $ gem install git-up 1. Stash 2. Fetch

    3. Rebase all branches 4. Unstash
  6. Rebase versus Merge • Rebase • Deal with merge conflicts

    for each commit that gets replayed • Cleaner history • Requires a force-push, replacing history • Merge • One big merge conflict • Many merge commits into your branch
  7. Collaborator has force- pushed your branch • Don’t rebase if

    your collaborator is still working directly on the branch • Rebase of feature branch onto integration branch is still easy*
  8. Resources Atlassian Git tutorial - https://www.atlassian.com/git/tutorial Try Git - https://try.github.io

    PeepCode Git Internals PDF - https://github.com/pluralsight/git- internals-pdf/releases Pro Git book - http://git-scm.com/book Git website - http://git-scm.com/