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/07 14:40] – [The fundamental rebase operation] 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 | ||
| </ | </ | ||
| ===== The fundamental rebase operation ===== | ===== The fundamental rebase operation ===== | ||
| - | Three components: | + | Three components |
| * the //branch// to be rebased | * the //branch// to be rebased | ||
| Line 21: | Line 26: | ||
| * the target //commit// onto which to rebase | * the target //commit// onto which to rebase | ||
| - | Simple example: | + | ===== Examples ===== |
| + | |||
| + | ==== Simple example | ||
| < | < | ||
| - | A---B---C topic | + | A---B---C |
| / | / | ||
| - | D---E---F---G master | + | D---E---F---G |
| </ | </ | ||
| - | Example requiring | + | One of: |
| + | |||
| + | < | ||
| + | $ git checkout topic | ||
| + | $ git rebase master | ||
| + | </ | ||
| + | |||
| + | or: | ||
| + | |||
| + | < | ||
| + | $ git rebase master topic | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | A'--B'--C' | ||
| + | / | ||
| + | D---E---F---G | ||
| + | </ | ||
| + | |||
| + | ==== Example requiring "--onto newbase" ==== | ||
| < | < | ||
| Line 38: | Line 64: | ||
| o---o---o | o---o---o | ||
| </ | </ | ||
| - | ===== DESCRIPTION ===== | ||
| < | < | ||
| - | If < | + | $ git rebase |
| - | git checkout < | + | |
| - | remains on the current branch. | + | |
| </ | </ | ||
| - | |||
| - | In other words, the final optional argument '' | ||
| < | < | ||
| - | $ git checkout < | + | o---o---o |
| + | / | ||
| + | o---o---o---o---o | ||
| + | \ | ||
| + | o---o---o---o---o | ||
| </ | </ | ||
| - | then just pretend it says '' | ||
| - | ===== Examples ===== | ||
| ==== Removing a sequence of commits ===== | ==== Removing a sequence of commits ===== | ||
| Line 67: | Line 90: | ||
| < | < | ||
| - | $ git rebase --onto B D | + | $ git rebase --onto B D [HEAD] |
| </ | </ | ||