Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_rebase [2019/03/04 21:43] – [DESCRIPTION] rpjday | git_rebase [2019/04/06 21:34] (current) – [Removing a sequence of commits] rpjday | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| < | < | ||
| - | git rebase [-i | --interactive] [< | + | $ git rebase [-i | --interactive] [< |
| - | [< | + | |
| - | git rebase [-i | --interactive] [< | + | [< |
| - | --root [< | + | |
| - | git rebase --continue | --skip | --abort | --quit | --edit-todo | --show-current-patch | + | $ git rebase [-i | --interactive] [< |
| + | | ||
| + | --root [< | ||
| + | - | ||
| + | $ git rebase --continue | --skip | --abort | --quit | | ||
| + | --edit-todo | --show-current-patch | ||
| </ | </ | ||
| - | ===== DESCRIPTION | + | ===== The fundamental rebase operation |
| + | |||
| + | Three components define a rebase: | ||
| + | |||
| + | * the //branch// to be rebased | ||
| + | * the amount of that branch to be rebased | ||
| + | * the target //commit// onto which to rebase | ||
| + | |||
| + | ===== Examples ===== | ||
| + | |||
| + | ==== Simple example | ||
| < | < | ||
| - | If < | + | A---B---C |
| - | git checkout < | + | / |
| - | remains on the current branch. | + | |
| </ | </ | ||
| - | ===== Examples ===== | + | One of: |
| + | |||
| + | < | ||
| + | $ git checkout topic | ||
| + | $ git rebase master | ||
| + | </ | ||
| + | |||
| + | or: | ||
| + | |||
| + | < | ||
| + | $ git rebase master topic | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | A' | ||
| + | / | ||
| + | D---E---F---G | ||
| + | </ | ||
| + | |||
| + | ==== Example requiring " | ||
| + | |||
| + | < | ||
| + | o---o---o---o---o | ||
| + | \ | ||
| + | o---o---o---o---o | ||
| + | \ | ||
| + | o---o---o | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | $ git rebase --onto master next topic | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | o---o---o | ||
| + | / | ||
| + | o---o---o---o---o | ||
| + | \ | ||
| + | o---o---o---o---o | ||
| + | </ | ||
| + | |||
| ==== Removing a sequence of commits ===== | ==== Removing a sequence of commits ===== | ||
| Line 34: | Line 90: | ||
| < | < | ||
| - | $ git rebase --onto B D | + | $ git rebase --onto B D [HEAD] |
| </ | </ | ||