Last active
July 15, 2016 23:07
-
-
Save noel-yap/f9ccf3ffcb2e4be56f4d514376253052 to your computer and use it in GitHub Desktop.
Adds `upstream` to clone of Github repo.
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 | |
| proj_repo=$(git config --get remote.origin.url | sed -E -e 's|(ssh://)?git@github.com[/:]||' -e 's|\.git$||') | |
| upstream=$(curl "https://api.github.com/repos/${proj_repo}" | jq '.parent.git_url' | sed -e 's|"||g') | |
| git remote add upstream ${upstream} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment