::create_from_github("https://github.com/data-and-visualization/git-tutorial") usethis
Git, GitHub & RStudio
RStudio users can leverage git Version-control which enhances reproducibility.
The usethis
package and the RStudio IDE will help you orchestrate your version control repositories as RStudio projects.
Setup
To get started, make a free GitHub.com account. Make sure you have the latest versions of R, RStudio, and usethis. Then, setup your RStudio configuration using two key documents: Setup, and Managing Git(Hub) Credentials.
Tips
Clone or fork from GitHub
Create the GitHub repo from local
library(usethis)
use_git() # initialize a git repo
use_git_ignore()
use_readme.Rmd()
use_ccby_license()
# Before next step → stage & commit changes
use_github() # Connect local repo to GitHub
Rename default branch
library(usethis)
git_default_branch()
git_default_branch_rename()
git_default_branch_rediscover()
set-up git and manage GitHub credentials
# Sign-in to your GitHub account
# Read: https://usethis.r-lib.org/articles/articles/git-credentials.html
# Read: https://usethis.r-lib.org/articles/articles/usethis-setup.html
::create_github_token()
usethis::gitcreds_set()
gitcreds::gh_whoami()
gh::gh_token_help()
usethis::use_git_config(user.name = "Jane Doe", user.email = "jane@example.com")
usethis::gh_token_help() usethis
Next Level…
Take your reproducibility to the next level. Make your code citable by connecting your GitHub repo and your ORCID (unique author ID) through to the Zenodo archival repository. Now, every time you commit a milestone release, you also mint a DOI.