Rebase

Zmiana bazy

Rebase

  • znajduje ostatniego wspólnego przodka gałęzi na której jesteś i względem której wykonujesz operację 
  • przesuwa się do tego przodka pobierając różnice wprowadzane przez kolejne rewizje w gałęzi w której się znajdujesz
  • zapisuje je w tymczasowych plikach
  • resetuje bieżącą gałąź do aktualnej rewizji gałęzi względem której wykonujesz operację zmiany bazy
  • aplikuje po kolei zapisane zmiany.

rebase

rebase

$ git checkout experiment
$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: ...

rebase

rebase --onto

Opcja --onto pozwala na przesunięcie bazy na inną gałąź lub rewizję

rebase --onto

Rebase --onto

$ git checkout client
$git rebase server --onto master
First, rewinding head to replay your work on top of it...
Applying: ...

rebase --onto

Współpraca przy użyciu rebase

git checkout feature/user-login
git checkout -b feature/user-login-fe
git commit -m "c"
git checkout feature/user-login
git commit -m "b1"
git checkout feature/user-login
git rebase master
git checkout feature/user-login-fe
git commit -m "c1"
git checkout feature/user-login-fe
git rebase feature/user-login
git checkout feature/user-login
git rebase -i master

pick b
fixup b1
git checkout feature/user-login-fe
git rebase -i feature/user-login

pick c
fixup c1
Made with Slides.com