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

Dr Gitlove

Paul Bowsher
December 02, 2013

Dr Gitlove

Or How I learned to stop worrying and love git rebase

Paul Bowsher

December 02, 2013
Tweet

More Decks by Paul Bowsher

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/