Last active
June 15, 2017 04:27
-
-
Save fhightower/f0c97f0ee7c1bdf7db992173515272a8 to your computer and use it in GitHub Desktop.
Clone github fork and set upstream
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
function gfork() { | |
# Clone a repo that is a fork ($1) and set an upstream repo ($2) | |
# clone the given repo | |
git clone $1; | |
# get the name of the cloned repo | |
REPO=$(echo $1 | grep -o "[^/]*\.git$") | |
# go into the directory of the cloned repo | |
cd ${REPO:0:(${#REPO} - 4)} | |
# set upstream | |
git remote add upstream https://github.com/$2.git | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment