Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when...

61
@JennyBryan @jennybc Happy Git and GitHub for the useR @STAT545 stat545-ubc.github.io

Transcript of Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when...

Page 1: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

@JennyBryan

@jennybc

Happy Git and GitHubfor the useR

@STAT545

stat545-ubc.github.io

Page 2: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

happygitwithr.com

Page 3: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Slides used in live workshops based on:

happygitwithr.com

Page 4: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Given the self-guided CSAMA lab format … here’s a little guidance for you.

Optional: read Why Git? Why GitHub?

Optional: look at the rest of these slides.

Prove you exist and have a GitHub account 🙂 - Put an emoji on this GitHub issue: CSAMA lab participants: What is your operating system?

Complete everything in these sections of happygitwithr.com - Installation - Connect Git, GitHub, RStudio - Get help from us if you need it! Setup is half the battle here.

Page 5: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Given the self-guided CSAMA lab format … here’s a little guidance for you.

Depending on your background and ambitions …

Do something from Early Usage section: - New project, GitHub first - Existing project, GitHub first - Existing project, GitHub last

Or choose something more advanced from Tutorial prompts section: - Clone a repo - Fork a repo - Create a bingo card … maybe for CSAMA? - Practice failure: burn it all down - Search GitHub … maybe Bioconductor specific searches?

Page 6: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Version control systems (VCS) were created to help groups of people develop software

Git, in particular, is being “repurposed” for activities other than pure software development … like the messy hybrid of writing, coding and data wrangling … and exposing the gory details… and collaborating with others

Page 7: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

What would Git adoption feel like?

Install Git. Configure it. Affirm RStudio can find it.

R project? Pre-existing or new. Dedicate a directory to it. Make that an RStudio Project. Make that a Git repository. Do your usual thing but … instead of just saving, you also make commits. Push to GitHub periodically.

Page 8: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

RStudio will offer a Git pane to help you make commits, view history and diffs, and push to / pull from GitHub.

Page 9: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

You — and possibly other people! — could visit the project on GitHub. For browsing and much more.

Page 10: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Do this now:

Put an emoji on this GitHub issue: CSAMA lab participants: What is your operating system?

Page 11: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Our battle-tested installation instructions:

happygitwithr.com

Page 12: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

By now you should have done this:

Complete everything in these sections of happygitwithr.com - Installation - Connect Git, GitHub, RStudio - Get help from us if you need it! Setup is half the battle here.

Page 13: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website
Page 14: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website
Page 15: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website
Page 16: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

https://github.com/Lokaltog/git-man-page-generatorhttps://git-man-page-generator.lokaltog.net

highly recommended stress relief

http://www.commitlogsfromlastnight.com

http://starlogs.net

Page 17: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

This is a good time to

Explore some of the comic relief resources, so you can find them again when Git despair strikes.

Page 18: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

agony : flow

Page 19: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

agony : flow

Page 20: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

agony reduction

Page 22: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

SourceTree, a free Git client for Windows and Mac.

Page 23: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Or do it like this … it’s your call.

Page 24: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

RStudio can also act as your Git(Hub) clienthttp://www.rstudio.com/ide/docs/version_control/overview

Page 25: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

This is a good time to do:

From Installation: - Install a Git client.

From Early Usage section: - New project, GitHub first

Page 26: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Use GitHubOr Bitbucket or Gitlab or …

Even if you keep things private and don’t collaborate.

Commit and push early and often!

Why, you ask?

Page 27: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

- Alberto Brandolini

Page 28: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

The amount of Git skilz necessary to fix a borked up

repo is an order of magnitude bigger than to bork it.

- Me

Page 29: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

burn it all down

Page 30: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website
Page 31: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website
Page 32: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

If that doesn't fix it, git.txt contains the phone number of a friend of mine who understands git. Just wait through a few minutes of 'It's really pretty simple, just think of branches as...' and eventually you'll learn the commands that will fix everything.

“burn it all down” workflow on explainxkcd.com

Page 33: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

This is a good time to do:

From Tutorial prompts section: - Practice failure: burn it all down

Page 34: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

increase flow

Page 35: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

machine readable&

human readable

Page 36: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

codecan bemachine & human readable

Page 37: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

datacan bemachine & human readable

Page 38: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

your projectcan bemachine & human readable

Page 39: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

code comments

README

explanation-of-mystifying-variable-names-and-codes.txt

Page 40: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

What is here? When did it last change?Who changed it? Why did they change it?Can I have it? Oh, I want that other version.

Page 41: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Commits are how the files evolve

Page 42: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Commit message = short description of what/why changed

Page 43: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

“diffs” show what actually changed

Page 44: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Issues for bug reports, feature requests, to do list, …

Page 45: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

This is a good time to

Find a package you use that is developed on GitHub

Explore its code, releases, and issues

or

Find a data analytical project you find interesting on GitHub

Explore its code! Maybe run it!

FiveThirtyEight shares data and code behind its stories and interactives at on GitHub

https://github.com/fivethirtyeight/data

Page 46: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

collaboration

Page 47: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

in theory more typical

GitHub

adapted from https://www.atlassian.com/git/tutorial/git-basics#!clone

Page 48: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Note the contributions to STAT 545 materials from one prof, 3 TAs, and one kind soul from the internet

Page 49: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

“Pull requests” are a mechanism to propose, discuss, and merge changes into a repository.

Page 50: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

when you’re the boss:

link to evolving files, don’t attach static copies to email

plain text everything you canuse Gitput it on the internet somewhere

when you’re not the boss:try to talk everyone into Google Docs 😉

Page 51: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

get a pseudo-website for free

Page 52: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

The unreasonable effectiveness of GitHub browsability

Page 53: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Impressive showing by Git here

Page 54: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Comma (.csv) and tab (.tsv) delimited files are automatically rendered nicely in GitHub repositoriesExample: some Lord of the Rings data

Page 55: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

When rendered Markdown is no longer enough …

<my_thing>.github.io

Page 56: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

When we push *.html to STAT 545 repo, website updates!

Page 57: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

the poor woman’s regression test of a

data analysis

Page 58: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

Your code’s the sameYour data’s the sameBut you updated R + pkgsSurprise!

Page 59: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website
Page 60: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website
Page 61: Happy Git and GitHub for the useR - Bioconductor · use Git put it on the internet somewhere when you’re not the boss: try to talk everyone into Google Docs # get a pseudo-website

subtle fig changes due to ggplot2 release