Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mislav
Copy link
Contributor

@mislav mislav commented Mar 31, 2020

This adds an "upstream" remote for the parent repository in addition to the "origin" remote. During an in-repo repo fork operation, an existing "origin" remote that previously pointed to the parent repo will now be renamed to "upstream" for consistency.

Fixes #582

Followup items:

  • Decide whether and how to extend this behavior to the fork scenario in pr create as well.

Copy link
Contributor

@vilmibm vilmibm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one nit about a function name, otherwise 👍

return nil
}

func addUpstreamRemote(parentRepo ghrepo.Interface, cloneURL string) error {
Copy link
Contributor

@vilmibm vilmibm Mar 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this naming is confusing to me since it sounds like it's just talking about adding an entry with git remote add. If it's also going to clone maybe something like createUpstreamRemote would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this function only literally adds a remote with git remote add, so I feel its name is in order. Cloning is done outside of the function, but cloneURL is passed so that the function knows how to cd into the proper git directory before executing git remote add (this is done via the -C <dir> git flag)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i...completely misread this code

nevermind and carry on

@vilmibm vilmibm merged commit 742a194 into master Mar 31, 2020
@mislav mislav deleted the fork-rename-remotes branch April 1, 2020 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update remote naming when using gh repo fork to use origin & upstream

3 participants