Skip to content
Rebase patches that no longer apply to HEAD
Shell
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
roundup @ 65d30b2
.gitmodules Add tests.
Makefile
README.md Update README, merged into visionmedia/git-extras
git-rebase-patch-test.sh Add failing test: Stay on the branch.
git-rebase-patch.1
git-rebase-patch.sh
test-repo.tar.gz

README.md

git rebase-patch

This tool has been merged into https://github.com/visionmedia/git-extras. Future improvements and bug fixes will be found only there.

Given you have a patch that doesn't apply to the current HEAD, but you know it applied to some commit in the past, git rebase-patch will help you find that commit and do a rebase.

Usage: git rebase-patch <patch-file.patch>

(Note: If the patch has been created with git format-patch, it is better and more efficient to use git am, because that considers meta information from the patch.)

Example

You can reroll a patch against the current HEAD like this:

git rebase-patch old-patch.patch

That might give you:

Trying to find a commit the patch applies to...
Patch applied to 9d1a78c as 9e22d99
[master 4d28217] remove-second-paragraph.patch
 1 file changed, 2 deletions(-)

Now your latest commit has the changes of your patch. It's message is the patch file name. Then proceed as usual.

Reroll the patch:

git diff HEAD~1 > new-patch.patch

Change the commit message:

git commit --amend
Something went wrong with that request. Please try again.