User Tools

Site Tools


git_rebase

This is an old revision of the document!


Overview

Simple and advanced examples of rebasing.

SYNOPSIS

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

DESCRIPTION

If <branch> is specified, git rebase will perform an automatic
git checkout <branch> before doing anything else. Otherwise it
remains on the current branch.

Examples

Removing a sequence of commits

Given:

A <--- B <--- C <--- D <--- E <--- F  [HEAD]

we could remove C and D with:

$ git rebase --onto B D

to get:

A <--- B <--- E' <--- F'  [HEAD]
git_rebase.1551735833.txt.gz · Last modified: 2019/03/04 21:43 by rpjday