forked from InseadDataAnalytics/INSEADAnalytics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_fork.R
35 lines (29 loc) · 1.33 KB
/
update_fork.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Sync a forked copy of INSEADAnalytics with the master project. For details,
# see https://github.com/InseadDataAnalytics/INSEADAnalytics/issues/7
if (!suppressWarnings(require(git2r))) {
install.packages("git2r", repos="http://cran.r-project.org/", quiet=TRUE)
library(git2r)
}
repo <- repository(".")
if (!("upstream" %in% remotes(repo))) {
remote_add(repo, "upstream", "https://github.com/InseadDataAnalytics/INSEADAnalytics")
}
conf <- config(repo)
if (is.null(conf$local$user.name) && is.null(conf$global$user.name)) {
message("Your Github username is not yet configured for this repository.")
config(repo, user.name=readline("Github username: "))
}
if (is.null(conf$local$user.email) && is.null(conf$global$user.email)) {
message("Your Github email is not yet configured for this repository.")
config(repo, user.email=readline("Github email: "))
}
fetch(repo, "upstream")
checkout(repo, "master")
merge(repo, "upstream/master")
message("
Your local copy of INSEADAnalytics is now in sync with the master project.
You can update your remote copy by clicking 'Push' in the 'Git' panel or
by executing the following:
push(repo, credentials=cred_user_pass(readline('Github username: '), readline('Github password: ')))
")
# push(repo, credentials=cred_user_pass(readline("Github username: "), readline("Github password: ")))