Created
June 6, 2018 16:07
-
-
Save ad1992/22b9d8b379f16a6c65524bd4cfd5c4ca to your computer and use it in GitHub Desktop.
Fetch a branch from someone's fork on github
This file contains 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
echo "moving to current directory" | |
cd $PWD | |
echo -n "Enter name of the user whose forked branch you want to checkout" | |
read username | |
echo -n "Enter the name of the repository" | |
read repo | |
echo -n "Enter the name of the branch of the user" | |
read branch | |
git remote add $username git@github.com:$username/$repo.git | |
echo "Added remote repository" | |
git fetch $username | |
echo "fetching the user" | |
# will create a branch username-branchn in your local | |
git checkout -b $username-$branch $username/$branch | |
echo "$username-$branch branch created successfully" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment