Skip to content

Latest commit

 

History

History
165 lines (119 loc) · 5.69 KB

R_Git_GitHub.md

File metadata and controls

165 lines (119 loc) · 5.69 KB
<style> .section .reveal .state-background { background: white;} .section .reveal h1, .section .reveal p { color: black; position: relative; top: 1%;} </style> <style> .footer { color: black; background: white; position: fixed; top: 100%; text-align:left; width:100%; } </style>

R is to RStudio as Git is to GitHub

author: Cory Whitney ([email protected]) font-family: 'Helvetica' autosize: true css: mySlideTemplate.css <img src="R_Git_GitHub-figure/github.png" style="background:none; border:none; box-shadow:none;height="400"; width="400";"><img src="R_Git_GitHub-figure/INRES_Logo.png" style="background:none; border:none; box-shadow:none;height="100"; width="100";"><img src="R_Git_GitHub-figure/Uni_Bonn_Picture.png" style="background:none; border:none; box-shadow:none;height="200"; width="200";"><img src="R_Git_GitHub-figure/ZEF_Logo.png" style="background:none; border:none; box-shadow:none;height="200"; width="200";">

Automated version control

incremental: true

Never have I ever:

  • used 'cmd z' or 'ctrl z'
  • came to the office but left the work at home on another machine or USB
  • tried to co-author scripts by emailing files back and forth

Git is an open source version control tool, GitHub is a company that hosts Git repositories in the web and provides a web interface to interact with repos they host.


Git: overview

incremental: true right: 80% https://git-scm.com/


A better way to:

  • "undo" changes,
  • collaborate than mailing files back and forth, and
  • share code and other scientific work with the world.

plot of chunk unnamed-chunk-1

GitHub: overview

incremental: true right: 80%


your local repository consists of three "trees" maintained by git. the first one is your Working Directory which holds the actual files. the second one is the Index which acts as a staging area and finally the HEAD which points to the last commit you've made.


plot of chunk unnamed-chunk-2

Git and GitHub: getting stuck

incremental: true right: 80%


  • If you get stuck, just add “Git” to a search query e.g. a short description of your issue
  • Someone else has also been confused by it and has written about it
  • Thousands of talented programmers who scan the web and answer these problems

plot of chunk unnamed-chunk-3

Git and GitHub: basics

incremental: true right: 80%


Install Git & join Github (if you have not already):

Some useful tips on getting these running from our friends

GitHub: host for your code

incremental: true right: 80%


GitHub

plot of chunk unnamed-chunk-4

GitHub: intro hello-world

incremental: true

plot of chunk unnamed-chunk-5

https://guides.github.com/activities/hello-world/

Git: Command line

incremental: true right: 80% https://git-scm.com/


  • git reset --soft HEAD~1 or commit SHA we undo our last commit, but the changes contained in that commit are not lost

  • git reset --hard HEAD~1 or commit SHA we discard all changes we've made in the working directory

  • git stash
    move the waiting changes out of the queue