Created
September 30, 2015 22:20
-
-
Save mariusae/5d159c9250631718106b to your computer and use it in GitHub Desktop.
Restack a number of branches
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/bash | |
set -e | |
prev=$1 | |
shift | |
for b | |
do | |
if ! git checkout $b >/dev/null 2>&1 | |
then | |
echo "Failed to check out branch $v" >&2 | |
exit 1 | |
fi | |
echo "Rebasing $b onto $prev" >&2 | |
if ! git rebase HEAD^ --onto $prev >/dev/null 2>&1 | |
then | |
echo "Command \"git rebase HEAD^ --onto $prev\" failed" >&2 | |
exit 1 | |
fi | |
prev=$b | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment