Created
January 14, 2010 19:50
-
-
Save nachof/277438 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# It will only work if there is something staged and something unstaged, but it's just a proof of concept :) | |
TARGET=$1 | |
git stash --keep-index | |
git stash | |
ORIGINAL=$(git show -s --pretty=%H) | |
git reset --hard $TARGET | |
git stash pop | |
git commit -a --amend | |
for h in $(git log $TARGET..$ORIGINAL --reverse --pretty=%H); do git cherry-pick $h; done | |
git stash pop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment