Next: , Previous: , Up: Manipulating   [Contents][Index]

6.8 Rebasing

Also see the git-rebase(1) manpage. For information on how to resolve conflicts that occur during rebases see the preceding section.

r     (magit-rebase-popup)

This prefix command shows the following suffix commands along with the appropriate infix arguments in a popup buffer.

When no rebase is in progress, then the popup buffer features the following commands.

Using one of these commands starts a rebase sequence. Git might then stop somewhere along the way, either because you told it to do so, or because applying a commit failed due to a conflict. When that happens, then the status buffer shows information about the rebase sequence which is in progress in a section similar to a log section. See Information About In-Progress Rebase.

r p     (magit-rebase-onto-pushremote)

Rebase the current branch onto branch.<name>.pushRemote. If that variable is unset, then rebase onto remote.pushDefault.

r u     (magit-rebase-onto-upstream)

Rebase the current branch onto its upstream branch.

r e     (magit-rebase)

Rebase the current branch onto a branch read in the minibuffer. All commits that are reachable from head but not from the selected branch TARGET are being rebased."

r s     (magit-rebase-subset)

Start a non-interactive rebase sequence with commits from START to HEAD onto NEWBASE. START has to be selected from a list of recent commits.

By default Magit uses the --autostash argument, which causes uncommitted changes to be stored in a stash before the rebase begins. These changes are restored after the rebase completes and if possible the stash is removed. If the stash does not apply cleanly, then the stash is not removed. In case something goes wrong when resolving the conflicts, this allows you to start over.

Even though one of the actions is dedicated to interactive rebases, the popup also features the infix argument --interactive. This can be used to turn one of the other, non-interactive rebase variants into an interactive rebase.

For example if you want to clean up a feature branch and at the same time rebase it onto master, then you could use r-iu. But we recommend that you instead do that in two steps. First use ri to cleanup the feature branch, and then in a second step ru to rebase it onto master. That way if things turn out to be more complicated than you thought and/or you make a mistake and have to start over, then you only have to redo half the work.

Explicitly enabling --interactive won’t have an effect on the following commands as they always use that argument anyway, even if it is not enabled in the popup.

r i     (magit-rebase-interactive)

Start an interactive rebase sequence.

r f     (magit-rebase-autosquash)

Combine squash and fixup commits with their intended targets.

r m     (magit-rebase-edit-commit)

Edit a single older commit using rebase.

r w     (magit-rebase-reword-commit)

Reword a single older commit using rebase.

r k     (magit-rebase-remove-commit)

Remove a single older commit using rebase.

When a rebase is in progress, then the popup buffer features these commands instead.

r r     (magit-rebase-continue)

Restart the current rebasing operation.

In some cases this pops up a commit message buffer for you do edit. With a prefix argument the old message is reused as-is.

r s     (magit-rebase-skip)

Skip the current commit and restart the current rebase operation.

r e     (magit-rebase-edit)

Edit the todo list of the current rebase operation.

r a     (magit-rebase-abort)

Abort the current rebase operation, restoring the original branch.

Next: , Previous: , Up: Manipulating   [Contents][Index]