Git Rebases

Setup

Adding commit A

git checkout master
touch A
git add A
git commit -m "add A"
git push --set-upstream remote master

Adding commit B

git checkout -b feature-B
touch B
git add B
git commit -m "add B"
git push --set-upstream remote feature-B

Adding commit C

git checkout master
touch C
git add C
git commit -m "add C"
git push

Setup State

  B # feature-B & remote/feature-b
 /
A---C # master & remote/master

Rebase

git checkout feature-B
git rebase master
git push

Post Rebase State

   B remote/feature-b
  /   D feature-b
 /   /
A---C < master & remote/master