Skip to content

Instantly share code, notes, and snippets.

@noel-yap
Last active July 15, 2016 23:07
Show Gist options
  • Select an option

  • Save noel-yap/f9ccf3ffcb2e4be56f4d514376253052 to your computer and use it in GitHub Desktop.

Select an option

Save noel-yap/f9ccf3ffcb2e4be56f4d514376253052 to your computer and use it in GitHub Desktop.
Adds `upstream` to clone of Github repo.
#!/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