bin/git-push-feature-branch
2015-09-02 11:39:08 -07:00

18 lines
476 B
Bash
Executable file

#!/bin/sh
set -e # bail on errors
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
DEFAULT_REMOTE=$(git config --get branch.${CURRENT_BRANCH}.remote || true) # don't fail
if [[ -z "$DEFAULT_REMOTE" ]]; then
DEFAULT_REMOTE=$(git config --get branch.master.remote)
fi
REMOTE="${1:-$DEFAULT_REMOTE}"
BRANCH="${2:-$CURRENT_BRANCH}"
git update "$REMOTE" develop
git checkout develop
git merge --no-ff "$BRANCH"
git push
git checkout "$BRANCH"
git push -u "$REMOTE" "$BRANCH"