Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DFCI Introduction to Git and GitHub

DFCI Introduction to Git and GitHub

Data Science Seminar
Department of Data Sciences
Dana-Farber Cancer Institute

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

E1a375fbe8cc71e23307a519eb4848e9?s=128

Patrick Kimes

November 27, 2018
Tweet

Transcript

  1. Introduction to Git and GitHub Patrick Kimes, PhD Postdoctoral Fellow

    Dana-Farber Cancer Institute Harvard TH Chan School of Public Health Data Science Seminar November 27, 2018
  2. why care about Git and GitHub?

  3. why care about Git and GitHub? sharing collaboration version control

  4. Git software for managing files in a folder (repo)

  5. GitHub Git software for managing files in a folder (repo)

    GitHub cloud service for hosting Git repos
  6. GitHub GitHub cloud service for hosting Git repos /somewhere/on/my/computer/sigclust2/ https://github.com/pkimes/sigclust2/

    Git software for managing files in a folder (repo)
  7. GitHub Git software for managing files in a folder (repo)

    GitHub cloud service for hosting Git repos
  8. GitHub Git software for managing files in a folder (repo)

    GitHub cloud service for hosting Git repos
  9. Git software for managing files in a folder (repo)

  10. version control software Git software for managing files in a

    folder (repo)
  11. Git software for managing files in a folder (repo) version

    control software http://phdcomics.com/comics.php?f=1323 “I already have a system”
  12. rnaseq-analysis-update2-final.R rnaseq-analysis.R rnaseq-analysis-update.R rnaseq-analysis-update2.R rnaseq-analysis-update2-final-pkk.R “I already have a system”

    ad infinitum…
  13. rnaseq-analysis.R rnaseq-analysis.R rnaseq-analysis.R rnaseq-analysis.R rnaseq-analysis.R version control software “I already

    have a system” ad infinitum… rnaseq-analysis-update2-final.R rnaseq-analysis.R rnaseq-analysis-update.R rnaseq-analysis-update2.R rnaseq-analysis-update2-final-pkk.R
  14. version control software Git history of files is stored as

    a series of commits rnaseq-analysis.R rnaseq-analysis.R rnaseq-analysis.R rnaseq-analysis.R rnaseq-analysis.R
  15. version control software Git history of files is stored as

    a series of commits rnaseq-analysis.R
  16. version control software Git history of files is stored as

    a series of commits commit snapshot of file + useful message rnaseq-analysis.R
  17. version control software Add new analysis Update analysis parameters Try

    new method Remove older results Clean up notes for release rnaseq-analysis.R
  18. version control software Add new analysis Update analysis parameters Try

    new method Remove older results commit 6e40a27cb9415fd98fa3ef068efbb5e22eb7d497 Author: First Last <myemail@mydomain.com> Date: Sun Nov 18 11:10:25 2018 -0500 Clean up notes for release rnaseq-analysis.R
  19. rnaseq-analysis.R more commonly visualized horizontally Add new analysis Update analysis

    parameters Try new method Remove older results Clean up notes for release
  20. rnaseq-analysis.R checkout an older commit Add new analysis Update analysis

    parameters Try new method Remove older results Clean up notes for release
  21. rnaseq-analysis.R Add new analysis Update analysis parameters Try new method

    Remove older results Clean up notes for release inspect a diff between two commits
  22. rnaseq-analysis.R Add new analysis Update analysis parameters Try new method

    Remove older results Clean up notes for release commit best practices
  23. rnaseq-analysis.R Add new analysis Update analysis parameters Try new method

    Remove older results Clean up notes for release commit best practices 1. commits should be complete
  24. 1. commits should be complete 2. commit messages should be

    meaningful commit best practices https://xkcd.com/1296/ https://chris.beams.io/posts/git-commit/
  25. Git version control software for managing files in a folder

  26. repo folder of files; a Git project Git version control

    software for managing files in a folder
  27. repo folder of files; a Git project commit snapshot of

    files in a repo Git version control software for managing files in a folder
  28. Git version control software for managing files in a folder

    git repo
  29. GitHub GitHub cloud service for hosting Git projects Git version

    control software for managing files in a folder git repo
  30. GitHub GitHub cloud service for hosting Git projects Git version

    control software for managing files in a folder git repo git repo
  31. GitHub git repo git repo GitHub: hosting service

  32. GitHub git repo git repo GitHub: hosting service sharing newest

    version
  33. GitHub git repo git repo GitHub: hosting service sharing git

    repo collaboration
  34. GitHub git repo git repo GitHub: hosting service sharing git

    repo collaboration
  35. GitHub?

  36. GitHub?

  37. GitHub?

  38. GitHub?

  39. GitHub?

  40. GitHub?

  41. why can’t we just use… Google Drive Dropbox …?

  42. GitHub is more than just a cloud

  43. GitHub is more than just a cloud sharing share the

    complete Git history
  44. GitHub is more than just a cloud sharing collaboration share

    the complete Git history open the code to suggestions and fixes
  45. GitHub is more than just a cloud https://kbroman.org/github_tutorial/pages/why.html

  46. GitHub was built for Git

  47. GitHub was built for Git

  48. GitHub was built for Git

  49. GitHub was built for Git

  50. GitHub was built for Git

  51. GitHub was built for Git

  52. GitHub was built for Git

  53. GitHub was built for Git

  54. GitHub was built for Git

  55. BitBucket GitLab GitHub GitHub isn’t the only option, but it’s

    a good one
  56. GitHub cloud service for hosting Git projects GitHub git repo

    git repo
  57. GitHub cloud service for hosting Git projects GitHub git repo

    git repo remote hosted copy of a repo local remote
  58. GitHub cloud service for hosting Git projects GitHub git repo

    git repo remote hosted copy of a repo local remote push/pull sync commits between local/remote push
  59. GitHub cloud service for hosting Git projects GitHub git repo

    git repo remote hosted copy of a repo local remote push/pull sync commits between local/remote pull push
  60. push/pull sync commits between local/remote GitHub cloud service for hosting

    Git projects GitHub git repo git repo git repo remote pull push local local remote hosted copy of a repo pull push
  61. repo folder of files; a Git project commit snapshot of

    files in a repo Git version control software for managing files in a folder
  62. repo folder of files; a Git project commit snapshot of

    files in a repo Git version control software for managing files in a folder GitHub cloud service for hosting Git projects remote remote copy of repo push/pull sync commits between local/remote
  63. awesome!

  64. https://xkcd.com/1597/ Git and GitHub IRL (in real life)

  65. Git is command line Git is unfriendly

  66. enough with the what, on to the how

  67. enough with the what, on to the how what you’ll

    need: 1.Git 2.GitHub account
  68. 1.Git 2.GitHub account 3.Git GUI client enough with the what,

    on to the how what you’ll need:
  69. enough with the what, on to the how what you’ll

    need: 1.Git 2.GitHub account 3.Git GUI client GitHub Desktop GitKraken
  70. Git on the command line

  71. Git in RStudio

  72. Git in RStudio

  73. enough with the what, on to the how what you’ll

    need: 1.Git 2.GitHub account 3.Git GUI client 1. 2. 3. /username
  74. enough with the what, on to the how what you’ll

    need: 1.Git 2.GitHub account 3.Git GUI client link local/remote 1. 2. 3. /username
  75. enough with the what, on to the how

  76. None
  77. None
  78. None
  79. None
  80. None
  81. None
  82. None
  83. None
  84. None
  85. None
  86. None
  87. None
  88. None
  89. None
  90. None
  91. None
  92. pkimes$ git remote add origin https://github.com/pkimes/dfci-example.git pkimes$ git push -u

    origin master
  93. None
  94. None
  95. None
  96. None
  97. wait, I’m lost

  98. git repo local wait, I’m lost

  99. git repo local wait, I’m lost

  100. GitHub git repo local wait, I’m lost

  101. GitHub git repo git repo local remote wait, I’m lost

  102. GitHub git repo local remote link wait, I’m lost git

    repo
  103. GitHub git repo git repo local remote push wait, I’m

    lost
  104. awesome!

  105. wait, I’m still lost

  106. Alice Bartlett Senior Developer, Financial Times @alicebartlett Git for humans

    Git for humans https://speakerdeck.com/alicebartlett/git-for-humans
  107. happy Git and GitHub for the useR http://happygitwithr.com/

  108. introduction to data science (section VIII) https://rafalab.github.io/dsbook/

  109. data science course in a box https://github.com/rstudio-education/datascience-box

  110. let’s give it a try! https://rafalab.github.io/dsbook/ Sections 75 - 79