new more git and github - amelia mcnamara · 2020. 8. 5. · 4. from rstudio.cloud, create new...
TRANSCRIPT
![Page 1: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/1.jpg)
More git and Github
![Page 2: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/2.jpg)
1. Accept the organization invitation for STAT360 in your email
![Page 3: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/3.jpg)
what you need to write
what people like to read
foo.R foo.Rmd
foo.md foo.html
CC BY Jenny Bryan
![Page 4: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/4.jpg)
Deep
Thoughts
CC BY Jenny Bryan
![Page 5: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/5.jpg)
use version controlCC BY Jenny Bryan
![Page 6: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/6.jpg)
we teach Git + GitHubCC BY Jenny Bryan
![Page 7: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/7.jpg)
"commit" a file or project state that is meaningful to you for inspection, comparison, restoration
CC BY Jenny Bryan
![Page 8: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/8.jpg)
"diff"What changed here?
Why?
Δ
CC BY Jenny Bryan
![Page 9: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/9.jpg)
CC BY Jenny Bryan
![Page 10: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/10.jpg)
collaborationCC BY Jenny Bryan
![Page 11: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/11.jpg)
CC BY Jenny Bryan
![Page 12: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/12.jpg)
"clone"CC BY Jenny Bryan
![Page 13: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/13.jpg)
"clone"*not as useful as you might think because you can never send a PR
#$
#
origin
CC BY Jenny Bryan
![Page 14: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/14.jpg)
daily work, your stuff
pullpush
CC BY Jenny Bryan
![Page 15: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/15.jpg)
"clone" *not as useful as you might thinkCC BY Jenny Bryan
![Page 16: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/16.jpg)
"fork"CC BY Jenny Bryan
![Page 17: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/17.jpg)
"fork and clone"CC BY Jenny Bryan
![Page 18: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/18.jpg)
get changes from the main repo
push
pull requestorigin????
#$
#
CC BY Jenny Bryan
![Page 19: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/19.jpg)
contribute to other people's stuff
push
pull request
pull
CC BY Jenny Bryan
![Page 20: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/20.jpg)
Deep
Thoughts
CC BY Jenny Bryan
![Page 21: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/21.jpg)
"If it hurts, do it more often."
https://martinfowler.com/bliki/FrequencyReducesDifficulty.htmlCC BY Jenny Bryan
https://martinfowler.com/bliki/FrequencyReducesDifficulty.html
![Page 22: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/22.jpg)
"If it hurts, do it more often."
Apply this to git commit, pull, merge, push. (and restarting R, re-running your scripts)
Why? Take your pain in smaller pieces. Tight feedback loop can reduce absolute pain. Practice changes what you find painful.
CC BY Jenny Bryan
![Page 23: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/23.jpg)
1. Accept the organization invitation for STAT360 in your email
2. Go to github.com/STAT360 and create a team (??)
3. One (??) person from your group goes to https://classroom.github.com/g/5uxcrcBk to initialize the repo (fork)
4. From rstudio.cloud, create new project from version control, copy the git url like last time
![Page 24: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/24.jpg)
Copy this URL
![Page 25: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/25.jpg)
3. Make a new RStudio Cloud Project "from Git Repo"
![Page 26: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/26.jpg)
![Page 27: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/27.jpg)
Probably— enter Github credentials
![Page 28: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/28.jpg)
Introduce yourself to git
https://happygitwithr.com/hello-git.html
git config --global user.name 'Jane Doe'git config --global user.email '[email protected]'git config --global credential.helper 'cache --timeout 3600'git config --global --list
![Page 29: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/29.jpg)
1. Accept the organization invitation for STAT360 in your email
2. Go to github.com/STAT360 and create a team (??)
3. One (??) person from your group goes to https://classroom.github.com/g/5uxcrcBk to initialize the repo (fork)
4. From rstudio.cloud, create new project from version control, (copy the git url like last time)
5. (??) Make a new branch
6. Have one person work from their machine and make some changes, as the rest of you watch and contribute (maybe, on the screen)
7. One person commits + pushes to Github
8. Everyone else, pull from Github
![Page 30: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/30.jpg)
Recovering from Git(Hub) failure
Scenario: You try to push and cannot
What's the problem? There are changes on GitHub that you don't have.
Pull. If the gods smile upon you, merge works. Now push.
CC BY Jenny Bryan
![Page 31: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/31.jpg)
Let's create this situation.
Make sure local Git pane is clear. Make sure local and remote are synced (push, pull).
Edit & commit to file A locally. Edit & commit to file B remotely.
Try to push. You will fail.CC BY Jenny Bryan
![Page 32: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/32.jpg)
jenny@2015-mbp bunny-scarf $ git push To github.com:jennybc/bunny-scarf.git ! [rejected] master -> master (fetch first) error: failed to push some refs to '[email protected]:jennybc/bunny-scarf.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.
&
Remedy? Do what it says! pull, then push ... pull, then push ... pull, then push
CC BY Jenny Bryan
![Page 33: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/33.jpg)
Look at your Git history.
You will see a merge commit, where the local and remote changes were reconciled.
This is best case scenario and is likely with good Git habits (lots of small frequent commits and merges, no binary files in repo).
CC BY Jenny Bryan
![Page 34: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/34.jpg)
Recovering from Git(Hub) failureScenario: You pull and get a merge conflict.
What's the problem? GitHub can't figure out how to reconcile diffs.
Resolve the conflicts. Or abort ... and come back later.
CC BY Jenny Bryan
![Page 35: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/35.jpg)
Let's create this situation.
Make sure local Git pane is clear. Make sure local and remote are synced (push, pull).
Edit & commit to file A locally. Make conflicting edit & commit to file A remotely.
Try to push. You will fail. Try to pull. You will fail. All is fail.CC BY Jenny Bryan
![Page 36: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/36.jpg)
From github.com:jennybc/bunny-scarf 958548f..3357952 master -> origin/master Auto-merging README.md CONFLICT (content): Merge conflict in README.md Automatic merge failed; fix conflicts and then commit the result.
<<<<<<< HEAD Wingardium Leviosaaaaaaaa
======= Wing-GAR-dium Levi-O-sa >>>>>>> 33579525d88af071268b0a0c64c54f357712589a
CC BY Jenny Bryan
![Page 37: New More git and Github - Amelia McNamara · 2020. 8. 5. · 4. From rstudio.cloud, create new project from version control, (copy the git url like last time) 5. (??) Make a new branch](https://reader035.vdocuments.net/reader035/viewer/2022071217/604c4ab8365fc72f2e5d172f/html5/thumbnails/37.jpg)
From github.com:jennybc/bunny-scarf 958548f..3357952 master -> origin/master Auto-merging README.md CONFLICT (content): Merge conflict in README.md Automatic merge failed; fix conflicts and then commit the result.
<<<<<<< HEAD Wingardium Leviosaaaaaaaa
======= Wing-GAR-dium Levi-O-sa >>>>>>> 33579525d88af071268b0a0c64c54f357712589a
CC BY Jenny Bryan