node-gh / gh

(DEPRECATED) GitHub CLI made with NodeJS. Use the official https://cli.github.com/ instead.
http://nodegh.io
Other
1.71k stars 217 forks source link

"Add my remote" feature #419

Closed henvic closed 5 years ago

henvic commented 8 years ago

Sometimes I want to add a remote for a repo I have already forked, and I always have to rename origin with upstream, then add my remote as the origin. This involves copying & paste, replacing the username, and, etc. I want something like 'gh repo --add-me', except that I don't like --add-me for obvious reasons (it's not suggestive).

Do you guys suggest anything?

protoEvangelion commented 6 years ago

Ya that happens to me all the time. Hmm what about a --swap which can be aliased to -s.

So it would look like gh re --swap "upstreamUrl"

That would be cool if there was a way to programatically get the upstream repo!

protoEvangelion commented 5 years ago

On second thought since this isn't really a git tool, but more of a GitHub tool this shouldn't be a feature of gh.

I have a zsh alias that just runs two commands to make this simple:

function grswap() {
  git remote rename origin upstream
  git remote add origin $1
}