Skip to content

Commit

Permalink
Fix r-lib#695, for forked repositories, create_from_github() will pul…
Browse files Browse the repository at this point in the history
…l the upstream master
  • Loading branch information
ijlyttle committed Apr 4, 2019
1 parent 2a862fa commit 03317dc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ usethis gains tooling to manage part of a file. This currently used for managing
* `use_github()` and `create_from_github()` gain a `protocol` argument. The
default is still `"ssh"`, but it can be changed globally to `"https"` with
`options(usethis.protocol = "https")`. (#494, @cderv)
`options(usethis.protocol = "https")` (#494, @cderv). For forked
repositories, `create_from_github()` will pull the upstream master
(#695, @ijlyttle).
* `use_github_labels()` has been rewritten be more flexible. You can
now supply a repo name, and `descriptions`, and you can set
Expand Down
4 changes: 3 additions & 1 deletion R/create.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ create_project <- function(path,
#' push to `repo_spec` and `TRUE` if you cannot. If a fork is created, the
#' original target repo is added to the local repo as the `upstream` remote,
#' using your preferred `protocol`, to make it easier to pull upstream changes
#' in the future.
#' in the future; the master branch of your local repo will be pulled from
#' `upstream` master.
#' @param rstudio Initiate an [RStudio
#' Project](https://support.rstudio.com/hc/en-us/articles/200526207-Using-Projects)?
#' Defaults to `TRUE` if in an RStudio session and project has no
Expand Down Expand Up @@ -199,6 +200,7 @@ create_from_github <- function(repo_spec,
r <- git2r::repository(proj_get())
ui_done("Adding {ui_value('upstream')} remote: {ui_value(upstream_url)}")
git2r::remote_add(r, "upstream", upstream_url)
pr_pull_upstream()
}

rstudio <- rstudio %||% rstudioapi::isAvailable()
Expand Down
3 changes: 2 additions & 1 deletion man/create_from_github.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 03317dc

Please sign in to comment.