Github Collaboration
With Brooke and Tim
3 Nov 2022
Why use Github?
Emergent Lab Github
Git allows you to do something that you can’t in Google Docs, Microsoft Online etc - work on different versions of the same document independently and then manually merge the changes while saving all the intermediates
Working between local and remote repositories
git clone
First things first: Configure your SSH
Clone: copy of repository that lives remotely from the web server (allows for changes to original repository)
Fork: personal copy of another user’s repository that lives on your account (does not change the original repository)
Branch: parallel version of a repository which can be merged back to the main “live” version
Pull: act of proposing a change to a repository submitted by a user and reviewed by a contributor
Push: Send committed changes to a repository on github.com
Working between local and remote repositories
git clone
Command line Workflow
Practicing Github Collaboration
Together, we’re making a piece of “master code” by re-assembling the poem “Jabberwocky”
Tasks Cheat Sheet (DRAFT SLIDE)
Task #1: Add the following text to lines 9-12 of the text file “Jabberwoky_exercise.txt” :
“Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!”
Task #2: Add the following text to lines 24-27 of the text file “Jabberwoky_exercise.txt”:
One, two! One, two! And through and through
The vorpal blade went snicker-snack!
He left it dead, and with its head
He went galumphing back.
Task #3: Edit in line 4 “slithy toves” to “slimy toads” in the text file “Jabberwoky_exercise.txt”
Task #4: Add a new stanza to the end of the text file “Jabberwoky_exercise.txt” (write it if you want, or just copy something)
Task #5: Create a new file in the repository called “how_doth_the_crocodile.txt” with the poem How Doth the Little Crocodile? (text below): How doth the little crocodile
Improve his shining tail,
And pour the waters of the Nile
On every golden scale!
How cheerfully he seems to grin,
How neatly spreads his claws,
And welcomes little fishes in,
With gently smiling jaws!
Task #6: Add the following text to line 24 of the text file “Jabberwoky_exercise.txt”: “ONE, TWO! ONE, TWO! AND THROUGH AND THROUGH”
Task #7: Capitalize “vorpal sword” in the text file “Jabberwoky_exercise.txt”
Task #8: Add a definition for “gimble” at the end of the text file “Jabberwoky_exercise.txt”
Task #9: Add the names of the lab mates working on the document to the author line of the text file “Jabberwoky_exercise.txt”
Task #10: Rewrite line 17 with a new rhyming word in the text file “Jabberwoky_exercise.txt”
Now let’s review the pull requests together
Let’s Time Travel
What if we wanted to see what an earlier version of our master code looked like?
We can examine specific commits in branches that we made:
Git checkout BRANCHNAME
Creating a new branch from an old commit:
git branch NEW_BRANCH_NAME COMMIT_ID