Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_from_github(): ensure forked repos are current with upstream/master #695

Closed
ijlyttle opened this issue Apr 4, 2019 · 0 comments
Closed
Labels

Comments

@ijlyttle
Copy link
Contributor

@ijlyttle ijlyttle commented Apr 4, 2019

Follow-on from #685.

If I create_from_github() on someone else's repository for which I already have a GitHub fork (e.g. r-lib/usethis), the copy that gets cloned to my computer is my master branch, not the upstream master branch. I will probably want to start my work from the upstream master, rather than my likely-stale master. I know that this is easily fixed with pr_pull_upstream(), but I wonder if this might be a useful default behavior for create_from_github().

It would seem to be a matter of adding pr_pull_upstream() to the end of:

usethis/R/create.R

Lines 198 to 202 in 2749025

if (fork) {
r <- git2r::repository(proj_get())
ui_done("Adding {ui_value('upstream')} remote: {ui_value(upstream_url)}")
git2r::remote_add(r, "upstream", upstream_url)
}

I'm assuming that the feedback (ui_done()) from pr_pull_upstream() takes care of having to add something here ourselves.

I'll start a PR for this, subject to your guidance.

@jennybc jennybc added the git label Apr 4, 2019
ijlyttle added a commit to ijlyttle/usethis that referenced this issue Apr 4, 2019
@jennybc jennybc closed this in #697 Apr 5, 2019
jennybc added a commit that referenced this issue Apr 5, 2019
* Fix #695, for forked repositories, create_from_github() will pull the upstream master

* Tweak help

* Re-document
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants