Save 37% off PRO during our Black Friday Sale! »

Rebasing Workflow - OSCON 2015

Rebasing Workflow - OSCON 2015

A298fade27a9c2ebe7bea8f93997b5c6?s=128

Emma Jane Hogbin Westby

July 22, 2015
Tweet

Transcript

  1. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw A Rebasing Workflow Emma Jane Hogbin Westby www.gitforteams.com

    @emmajanehw
  2. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Agenda • the tl;dl • Rant: why I

    don't like rebasing • Rave: when / why I use rebase • Wrap-up • Q&A
  3. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw the tl;dl too long; didn't listen

  4. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Why should I rebase? • Because it makes

    your commit history easier to read, and manipulate. • “Because Joe told me to.”
  5. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Rebasing is like
 a malleable sports re-play. Step

    1. Rewind the history of your branch. Step 2. Apply new commits from an outside source. Step 3. Then re-apply your work.
  6. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw When should I rebase? • Before sharing proposed

    work. • To update your local working branch. • To split a commit into two. • To squash multiple commits into one. $ git rebase -i edit $ git rebase -i squash $ git rebase <branch_name>
  7. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw How do I rebase? • Squash a bunch

    of tiny commits into one: $ git rebase --interactive • Bring your local, working branch up-to-date $ git pull master $ git checkout my_local_branch $ git rebase master
  8. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Groundhog Day Conflict?! • Resolve the conflict and

    then immediately save your recorded solution with: $ git rerere • Proactively turn on REuse REcorded REsolution: $ git config --global rerere.enabled true • Bad merge? Git will remember the wrong resolution. Immediately forget how you resolved it with: $ git rerere forget
  9. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw How do I stop rebasing? • If things

    go right, it will stop on its own. • If there are tears, you can abort. $ git rebase --abort
  10. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw </tl;dl> let the rants begin!

  11. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Rant Why I don’t like rebasing.

  12. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Historical Revisionism

  13. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw

  14. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw

  15. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw

  16. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw

  17. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Rave Why I love the effects of rebasing.

  18. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Making Whole Thoughts

  19. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Resources for
 Good Commit Messages gitforteams.com/resources/commit-granularity.html

  20. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Converting Conversations to Conclusions

  21. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Patches vs. Pull Requests

  22. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Merge vs. Rebase

  23. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Drawing the history graph before running a command

    will help you choose the right command.
  24. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw

  25. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw

  26. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw

  27. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw Choosing a Strategy • Pull = Fetch +

    Merge • Merge -> no fast forward (“true merge”) • Merge -> with fast forward • Merge with --squash -> all into one • Rebase -> rewind + replay • Cherry Pick -> copy and paste commits
  28. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw In Summary • The benefits of rebasing are

    most apparent to projects with multiple branches and multiple committers. • Rebasing allows you to reshape commit history so that you are storing conclusions, not conversations. • Rebasing can be used in place of merge to update a branch and results in a simplified graph of your repository history. • Rebasing can be used interactively to reshape a series of commits.
  29. https://speakerdeck.com/emmajane/a-rebasing-workflow-for-git @emmajanehw www.gitforteams.com Emma Jane Hogbin Westby @emmajanehw