End Interactive Session 10
Find a partner. Designate who is “Starter” and who is “Collaborator”.
Working in main
Starter: Create a new version controlled R Project, make & push an update
- Create a new repo called
eds221-day10-collab
(with a ReadMe) - Clone, create a new version-controlled R Project
- Create a new .Rmd in the root (
git_test.Rmd
), delete everything below the first code chunk - Add a line of text in your
.Rmd
like “Hi partner!” - Stage, commit & push all changes back to your GitHub repo
Starter: Add a contributor
- Go back to your
eds221-day10-collab
repo on GitHub - Go to Settings > Manage access > (Enter password if requested) > Invite collaborator > Enter Collaborator’s username or email
Collaborator: Accept invitation & clone repo, make an update
- Check your email. You should receive the invitation to join the repo. Accept.
- Clone (do NOT fork first) and create your own local R project
- Pull just in case (this should say already up to date)
- Open the
git_test.Rmd
- Add a new line to the
.Rmd with
a nice note below the line your partner added - Save the
.Rmd
, then stage, commit, pull & push - Check that the updates show up on GitHub
Starter: Pull & add something new to the .Rmd
- PULL to get remote updates locally in RStudio
- Open
git_test.Rmd
and see updated text from your partner - Add a new line of text to the
.Rmd
- Stage, commit, pull, then push
Collaborator: Pull & add something new to the .Rmd
- PULL to get remote updates
- Open
git_test.Rmd
and see updated text - Add a new line of text to the
.Rmd
- Stage, commit, pull, then push
Starter and Collaborator: Where goes what now on GitHub?
- Both partners, go back to the repo on github for your collaboration
- Go exploring (especially History & Blame)
Starter and Collaborator: Submit a new issue that references specific line(s) in your files
- Still in GitHub, click on the
git_test.Rmd
file - Find a line that your partner wrote
- Click the row number to the left of the line (or hold shift to select a range a lines) - the selected lines will turn yellow, and you should see a three dot menu button appear to the left of the code. Click on it, and choose “Reference in new issue”
- Add a title and some text for your issue, and submit
- Once you both have submitted an issue to your shared repo, check your partner’s issue, respond and close (resolve) the issue
Working in branches
Starter and Collaborator: Create new branch
- Go to the GitHub repository and click on the branch icon next to the drop-down that currently says
main
. - This will take you to a new page that lists all of the branches currently associated with this repo
- Click “New branch”
- Give your new branch a short, but informative name. The best names include your name and a brief description of the updates you are planning (e.g.
oliver-interactive-visuals
) - Click “Create branch”
Starter and Collaborator: Work on new branch in local repo
- Now go to Terminal in RStudio and run
git pull
. You should see that a new branch was created - Check out the Git pane and click on the drop-down that currently says
main
. Select the new branch that you created. - Create a new file with some code or change code in an existing file
- Commit your changes to GitHub (still in your new branch)
Starter and Collaborator: Check out changes in remote repo
- Go back to GitHub
- You should now see a message that says your new branch has recent pushes
- You can toggle between branches to compare code between branches using the drop-down
Starter and Collaborator: Bring new changes into main
To have your new changes reflecting in the main branch, you need to submit a “pull request” (or a request to move your changes from your branch into the main branch)
- Click on
Compare and pull request
- Add a title and message describing the changes you made in your branch
- Scroll to the bottom to see the changes you are proposing to make to
main
- Click “Create pull request”
- GitHub will check if there are any conflicts between your changes and
main
- If not, click
Merge pull request
- You now can (and should) delete your branch by clicking
delete branch
You have now both successfully committed changes to the main branch without getting in each other’s way!