dotfiles/bin/git-up

22 lines
347 B
Plaintext
Raw Normal View History

2019-11-07 12:42:15 +00:00
#!/usr/bin/env bash
# Usage: git up {branch} {remote}
set -e
if [[ $# < 1 ]]; then
echo "You must specify a branch name to update"
exit 1
fi
BRANCH=$1
REMOTE=${2:-origin}
git checkout ${BRANCH} && \
git fetch ${REMOTE} && \
echo && \
git sl ${BRANCH}..${REMOTE}/${BRANCH} && \
echo && \
git pull --quiet && \
git checkout -