Git Cheatsheet - Quick Git Command Reference

Quick reference for common Git commands. Search, copy, and use Git commands instantly.

Share
Back to Git Cheatsheet

git rebase

Reapply commits on top of another base

Syntax

git rebase [options] <upstream> [<branch>]

Common Options

OptionDescription
-i, --interactiveInteractive rebase for editing history
--continueContinue rebase after resolving conflicts
--abortAbort rebase
--skipSkip current commit and continue
--onto <newbase>Rebase onto new base
--autostashAuto stash before rebase
--preserve-mergesPreserve merge commits

Examples

git rebase main

Rebase current branch onto main

git rebase -i HEAD~3

Interactively rebase last 3 commits

git rebase --onto main featureA featureB

Rebase featureB commits not in featureA onto main

git rebase --abort

Abort ongoing rebase

git rebase --continue

Continue rebase after conflicts

Related Commands

Related Tools

More Code & Dev Tools