gitGraph commit commit branch person_1 commit commit commit checkout main branch person_2 commit commit checkout main merge person_1 merge person_2 commit
Session 5
September 19, 2023
Word Bank
repo | commit | remote | push | pull | add
git
___ is used to tell git to track a filegit
____ is used to synchronize changes on your computer with a remoteDid anyone add a repo to GitHub? What difficulties did you encounter?
Everyone practice cloning this example repo as a new RStudio project: https://github.com/cct-datascience/repro-workshop-demo 1
Need one volunteer to edit the README.md and practice commit + push
What happens when two people make conflicting edits to a file and push them?
Creates a merge conflict
git pull
These are alternative ways to deal with conflicts—we won’t get into the details
For now, we recommend you stick with the “merge” option
Resolve the conflict however you want (i.e. keep one of the two sections)
Delete all lines with <<<<<<<
, >>>>>>>
, or =======
Save and commit
Each person works on a “branch”—an independent series of commits that can be merged back into the “main” branch.
gitGraph commit commit branch person_1 commit commit commit checkout main branch person_2 commit commit checkout main merge person_1 merge person_2 commit
Make a new branch using RStudio’s Git pane (for this demo, use your name)
Commit changes and push to your branch
View changes on GitHub
A request to merge changes into the main branch
Need another volunteer to share screen and be guided through making a pull request
This time, everyone can follow along!
What if you don’t have permission to push to a GitHub repo but you want to contribute?
Make a fork!
To contribute to a repo you don’t have push permission for:
Learn more, including handy usethis
shortcuts: https://happygitwithr.com/fork-and-clone
Exercise
In pairs, practice this workflow to make a PR to our example repo