Created
July 18, 2011 18:55
-
-
Save tmhedberg/1090322 to your computer and use it in GitHub Desktop.
Rebase a "tree" (connected DAG) of Git branches onto a common new base
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 | |
branches=$( | |
git branch --contains ` | |
git rev-list $1..$2 | | |
tail -n 1 | |
` | | |
sed 's/^..//' | |
) | |
echo $branches | |
echo -n 'Rebase these branches? Warning: merges will not be preserved! (y/n)>' | |
read | |
[[ $REPLY != y ]] && | |
exit | |
for b in $branches; do | |
git rebase --committer-date-is-author-date $1 $b | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment