Last active
April 7, 2018 18:10
-
-
Save NorbertFenk/fb1ea60a2d185e35176aa8bf06f269e9 to your computer and use it in GitHub Desktop.
Multiple branch rebase to a dedicated branch. Checkout the target branch and use the script.
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 | |
# checkout the target branch | |
# ./multiple-branch-rebase.sh <branch1> <branch2> ... | |
set -e | |
TARGET_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
for BRANCH in "$@"; do | |
git checkout $BRANCH | |
git rebase -i $TARGET_BRANCH | |
git push -f | |
git checkout $TARGET_BRANCH | |
git merge --no-edit --no-ff $BRANCH | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment