GitHub
Session 5
September 17, 2024
Today’s goals
- Practice using git with RStudio
- Explore commit history
- Put a local repo on GitHub
- Use
git push
and git pull
to synchronize with GitHub
Working with git in RStudio (Live Coding)
The most common git commands can be used with the RStudio GUI.
Sharing with GitHub
Connect With GitHub (Live Coding)
- Set up your computer to “talk” to GitHub with steps in
git_sitrep()
- Connect your local git repo to a remote GitHub repo with
use_github()
- Explore the GitHub interface
Work With RStudio and GitHub (Live Coding)
- Push local changes to GitHub
- Pull GitHub changes to local
Ignoring files
- If you enabled git with Rstudio or
usethis
, a .gitignore file was added for you, explore the contents
.gitignore
also prevents files from being synced to GitHub
- Use to keep large and non “diff-able” files local only to avoid GitHub file size limits
- Use to prevent sensitive information from getting on GitHub (e.g. sensitive data, API tokens)
- Cons: if ignored files are inputs, less reproducible and no backup on GitHub
- If a file is already tracked by git, you can’t (easily) retroactively remove it from git history and GitHub.
Your Tasks
- Put your research compendium on GitHub (e.g. with
use_github()
) and share the link in our Slack channel (if it can be made public)
- Explore other research compendia shared in Slack