Doctor Gitlove

68da6fcedf72fee45fdd633c50d7e1e7?s=47 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

68da6fcedf72fee45fdd633c50d7e1e7?s=128

globaldev

November 28, 2013
Tweet

Transcript

  1. 3.

    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. 15.

    Objects • Referred to by SHA-1 of their contents •

    Blob • Tree • Commit • Tag • Immutable
  3. 25.

    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. 34.

    Reset •--hard • Resets all including working copy •--mixed (default)

    • Resets all excluding working copy •--soft (git commit --amend) • Resets commit only
  5. 36.

    git up $ gem install git-up 1. Stash 2. Fetch

    3. Rebase all branches 4. Unstash
  6. 40.

    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. 43.

    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. 46.

    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/