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

Git Rebase

Git Rebase

Introduction to Git Rebase by me at Inviqa Enlighening Lunch

Arturas Smorgun

August 29, 2013
Tweet

More Decks by Arturas Smorgun

Other Decks in Programming

Transcript

  1. • Git Internal Data Structures; • Interactive Rebase; • Basic

    Rebase; • Less Basic Rebase; • Use Case. Contents
  2. • Content-addressable filesystem; • Insert content -- get key back;

    • You can add to graph, but not edit or remove. Git
  3. • blob -- file contents • tree -- directory layouts

    and filenames • commit -- forms git commit graph • tag -- annotated tag Objects
  4. Interactive • Remove or rearrange commits; • Edit commit messages;

    • Amend commits; • Squash several commits; • Run shell commands.
  5. --autosquash • Used in interactive rebase; • Commits starting with

    “squash! “ will be automatically marked to squash.
  6. git rebase • Forward-port local commits to the updated upstream

    head (from manual); • One of the ways to integrate changes from one branch to another (from the internets).
  7. How it works? • Go to common ancestor; • get

    diff by each commit of current branch; • save diffs to temporary files; • reset current branch to same commit as branch you rebasing onto; • apply each change in turn.
  8. $ git rebase --onto <newbase> <base> <tip> <newbase> -- branch,

    to which rebasing; <next> -- ancestor of rebase branch; <topic> -- tip of rebase branch;
  9. Thank you! See Inviqa Training “Git Beyond the Basics” by

    Alistair Stead and “Pro Git” ebook at http://git-scm.com/book by Scot Chacon