git-rebase-patch

Rebase with patch application

TLDR

Rebase and apply patch
$ git rebase-patch [patch_file]

SYNOPSIS

git rebase-patch patchfile_

DESCRIPTION

git rebase-patch finds where an old patch file still applies and replays it onto the current HEAD. This git-extras command is for patches that no longer apply cleanly to HEAD: it walks backward through parent commits, testing the patch against each historical tree with a temporary index, until it finds one it applies to. It then manufactures a commit there and cherry-picks it forward onto the current branch.This is useful for reviving an old, bit-rotted patch without manually figuring out which commit it was written against.

INSTALL

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

CAVEATS

Part of git-extras package. Only searches back along the first-parent chain from HEAD; if the patch was based on a commit outside that chain, it will not be found.

SEE ALSO

git-rebase(1), git-am(1), git-cherry-pick(1), git-extras(1)

RESOURCES

Source code · Documentation