Lecture 8 Rebasing Schedule March 29 Rebasing April 5 When - - PowerPoint PPT Presentation

lecture 8
SMART_READER_LITE
LIVE PREVIEW

Lecture 8 Rebasing Schedule March 29 Rebasing April 5 When - - PowerPoint PPT Presentation

Sign in on the attendance sheet! Lecture 8 Rebasing Schedule March 29 Rebasing April 5 When Things Go Wrong April 12 Visual Git Tools April 19 Carnival, no class April 26 Plumbing and Porcealin May 3 Final Last Time Centralized


slide-1
SLIDE 1

Lecture 8 Rebasing

Sign in on the attendance sheet!

slide-2
SLIDE 2

Schedule

March 29 Rebasing April 5 When Things Go Wrong April 12 Visual Git Tools April 19 Carnival, no class April 26 Plumbing and Porcealin May 3 Final

slide-3
SLIDE 3

Last Time

  • Centralized Workflow
  • Integration Manager Workflow

Local Computer Github/ “The cloud”

slide-4
SLIDE 4

You need to keep your fork up to date

Developer Public Repository Developer Private Repository Integration Manager Repository Blessed Repository

slide-5
SLIDE 5

You need to keep your fork up to date

In the private developer repo $ git remote add upstream https://github.com/autolab/Autolab.git $ git fetch upstream $ git checkout master $ git merge upstream/master $ git push origin master

slide-6
SLIDE 6

A B

Ilan’s Computer

  • rigin/master

master HEAD

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 1. Ilan Makes a Bugfix
slide-7
SLIDE 7

A B C

Ilan’s Computer

  • rigin/master
  • 1. git fetch origin

master HEAD

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 1. Ilan Makes a Bugfix
slide-8
SLIDE 8

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 1. Ilan Makes a Bugfix

A B C

Ilan’s Computer

  • rigin/master
  • 1. git fetch origin
  • 2. git merge origin/master

master HEAD

slide-9
SLIDE 9

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 1. Ilan Makes a Bugfix

A B C

Ilan’s Computer

  • 1. git fetch origin
  • 2. git merge origin/master

master HEAD

  • rigin/master
slide-10
SLIDE 10

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 1. Ilan Makes a Bugfix

A B C

Ilan’s Computer

  • 1. git fetch origin
  • 2. git merge origin/master
  • 3. git checkout –b bugfix

git commit –m "D"

master

  • rigin/master

D

HEAD bugfix

slide-11
SLIDE 11

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 1. Ilan Makes a Bugfix

A B C

Ilan’s Computer

  • 1. git fetch origin
  • 2. git merge origin/master
  • 3. git checkout –b bugfix

git commit –m "D“

  • 4. git checkout master

git merge bugfix

  • rigin/master

D

HEAD bugfix master

slide-12
SLIDE 12

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 1. Ilan Makes a Bugfix

A B C

Ilan’s Computer

  • 1. git fetch origin
  • 2. git merge origin/master
  • 3. git checkout –b bugfix

git commit –m "D“

  • 4. git checkout master

git merge bugfix

  • 5. git push origin master

D

HEAD bugfix master

  • rigin/master
slide-13
SLIDE 13

Aaron’s Computer

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 2. Aaron is working on a feature

A B C

  • rigin/master

master HEAD

slide-14
SLIDE 14

Aaron’s Computer

  • 1. git checkout –b my-feature

git commit –m "E"

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 2. Aaron is working on a feature

A B C

  • rigin/master

my-feature HEAD

E

master

slide-15
SLIDE 15

Aaron’s Computer

  • 1. git checkout –b my-feature

git commit –m "E"

  • 2. git fetch origin

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 2. Aaron is working on a feature

A B C E

master

D

  • rigin/master

my-feature HEAD

slide-16
SLIDE 16

Aaron’s Computer

  • 1. git checkout –b my-feature

git commit –m "E"

  • 2. git fetch origin
  • 3. git merge origin/master

ewww this sucks!

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 2. Aaron is working on a feature

A B C

my-feat HEAD

E

master

D

  • rigin/master

F

slide-17
SLIDE 17

Aaron’s Computer

much cleaner! E' is the same as E but with a different parent

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 2. Aaron is working on a feature

A B C

my-feat HEAD

E

master

D

  • rigin/master
  • rigin/master

E'

slide-18
SLIDE 18

Rebasing

  • Rebasing rewrites your git history,

replaying the diffs of your commits

  • Useful as an alternative to merging

when you want to keep history neat

slide-19
SLIDE 19

Aaron’s Computer

  • 1. git checkout –b my-feature

git commit –m "E"

  • 2. git fetch origin

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 2. Aaron is working on a feature

A B C E

master

D

  • rigin/master

my-feature HEAD

slide-20
SLIDE 20

Aaron’s Computer

  • 1. git checkout –b my-feature

git commit –m "E"

  • 2. git fetch origin
  • 3. git rebase origin/master

(Sometimes) Need to Get Changes from Master into Topic Branch

  • 2. Aaron is working on a feature

A B C E'

master

D

  • rigin/master

my-feature HEAD

slide-21
SLIDE 21

Activity/Homework

Rebase the changes you made a PR for last week on top of the new upstream/master and push to your branch. Your PR should update automatically. push -f (force push)