Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ===== Overview ===== Simple and advanced examples of rebasing. ===== SYNOPSIS ===== <code> $ git rebase [-i | --interactive] [<options>] [--exec <cmd>] [--onto <newbase>] [<upstream> [<branch>]] $ git rebase [-i | --interactive] [<options>] [--exec <cmd>] [--onto <newbase>] --root [<branch>] - $ git rebase --continue | --skip | --abort | --quit | --edit-todo | --show-current-patch </code> ===== 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 ==== <code> A---B---C topic / D---E---F---G master </code> One of: <code> $ git checkout topic $ git rebase master </code> or: <code> $ git rebase master topic </code> <code> A'--B'--C' topic / D---E---F---G master </code> ==== Example requiring "--onto newbase" ==== <code> o---o---o---o---o master \ o---o---o---o---o next \ o---o---o topic </code> <code> $ git rebase --onto master next topic </code> <code> o---o---o topic / o---o---o---o---o master \ o---o---o---o---o next </code> ==== Removing a sequence of commits ===== Given: <code> A <--- B <--- C <--- D <--- E <--- F [HEAD] </code> we could remove C and D with: <code> $ git rebase --onto B D [HEAD] </code> to get: <code> A <--- B <--- E' <--- F' [HEAD] </code> git_rebase.txt Last modified: 2019/04/06 21:34by rpjday