Created
May 28, 2019 15:18
-
-
Save bazay/1da22ea75116cde6ae9da0e3e1a5ded2 to your computer and use it in GitHub Desktop.
A helpful bash script that allows you to simply
This file contains hidden or 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 | |
# | |
# gup BRANCH | |
# | |
# Update origin with upstream for a specified branch. This allows you to update a branch on your forked repo | |
# with the most up-to-date version on the parent, all via the CLI. | |
# | |
# Note* This function assumes the following remotes: | |
# 1. `origin` - Refers to your forked repository, required; | |
# 2. `upstream` - The parent of your forked repository. | |
function gup () { | |
if [[ -z "$1" ]]; then | |
echo "ERROR: Please specify a branch name! E.g." | |
echo " gup BRANCH" | |
return 1 | |
fi | |
git fetch upstream && git co $1 && git pull upstream $1 && git push origin $1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment