LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

git-rebase

Reapply commits on new base

TLDR

Rebase onto branch
$ git rebase [branch]
copy
Interactive rebase
$ git rebase -i [commit]
copy
Rebase last N commits
$ git rebase -i HEAD~[n]
copy
Continue after conflict
$ git rebase --continue
copy
Abort rebase
$ git rebase --abort
copy
Skip current commit
$ git rebase --skip
copy
Rebase onto specific base
$ git rebase --onto [newbase] [oldbase] [branch]
copy

SYNOPSIS

git rebase [options] [upstream] [branch]

DESCRIPTION

git rebase reapplies commits on top of another base tip, producing a linear project history. It finds the common ancestor of the current branch and the upstream, then replays each commit from the current branch onto the upstream tip.Interactive mode (`-i`) allows reordering, squashing, editing, or dropping commits during the replay, making it a powerful tool for cleaning up commit history. The `--onto` option enables advanced workflows like moving a branch to an entirely new base. Autosquash automatically applies fixup! and squash! commits, supporting the iterative fixup workflow.

PARAMETERS

-i, --interactive

Interactive mode.
--onto newbase
Rebase onto different base.
--continue
Continue after resolving.
--abort
Cancel rebase.
--skip
Skip current patch.
--autosquash
Auto-apply fixup/squash.
--autostash
Auto-stash changes.
-x cmd
Run command after each commit.
-r, --rebase-merges
Recreate merge commits instead of flattening history (replaces the deprecated `--preserve-merges`).

INSTALL

sudo apt install git
copy
sudo dnf install git
copy
sudo pacman -S git
copy
sudo apk add git
copy
sudo zypper install git
copy
brew install git
copy
nix profile install nixpkgs#git
copy

CAVEATS

Rebasing rewrites history. Don't rebase commits that have been pushed to shared branches.

SEE ALSO

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid