Skip to content

Instantly share code, notes, and snippets.

@westonruter

westonruter/preview-branch.sh Secret

Last active Aug 29, 2015
Embed
What would you like to do?
#!/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