-
-
Save westonruter/dd264e10b1e2c2388a6a 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/bash | |
# preview-branch.sh: Merge the current branch into the preview branch, push, and return to the original branch. | |
set -e | |
current_branch=$( git rev-parse --abbrev-ref HEAD ) | |
if [ 'preview' == "$current_branch" ]; then | |
echo "Oops. You're already on the preview branch. Do you get merge conflicts?" | |
exit 1 | |
fi | |
git checkout preview | |
git pull origin preview | |
git merge "$current_branch" --no-edit | |
git push -u origin preview | |
git checkout "$current_branch" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment