Created
March 4, 2019 08:09
-
-
Save Jamesking56/f681c0aeaddbfc5912d52af961cdbfb4 to your computer and use it in GitHub Desktop.
Git Rebaser - Rebase your branch using a given base branch. No need for merge commits!
This file contains hidden or 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 | |
set -eu | |
if [ $# -eq 0 ]; then | |
echo "Git Rebaser" >&2 | |
echo "Usage:" >&2 | |
echo "rebase {base_branch}" >&2 | |
exit 1 | |
fi | |
BASE=$1 | |
SOURCE=$(git branch | grep \* | cut -d ' ' -f2) | |
echo "Rebasing $SOURCE using $BASE..." | |
git pull --rebase | |
git checkout $BASE && \ | |
git fetch -p && \ | |
git pull && \ | |
git checkout $SOURCE && \ | |
git rebase -i $BASE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment