Skip to content

Instantly share code, notes, and snippets.

@mhartington
Created May 21, 2018 21:03
Show Gist options
  • Save mhartington/d0c93d31d3cd5a0c3b15c46a06fbb44f to your computer and use it in GitHub Desktop.
Save mhartington/d0c93d31d3cd5a0c3b15c46a06fbb44f to your computer and use it in GitHub Desktop.
function ghUpdate() {
if git remote | grep upstream > /dev/null; then
echo "upstream is set"
elif [ -z "$1" ]; then
read "?Whats the URl of the original repo? " answer
git remote add upstream $answer
else
git remote add upstream $1
fi
git fetch upstream
git checkout master
git rebase upstream/master
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment