@darwinanddavis

Press F for fullscreen
Press W for widescreen

Location

What the hell is git and Github?

Version control system for data

Logs commits of file changes retrievable at any time

What the hell is git and Github? (cont …)

Applications

Version control

Collaborate

Centralised storage of every possible file type, e.g. Supp Material

Dynamic loading of stored links and programs

require(RCurl)
script <- getURL("https://raw.githubusercontent.com/darwinanddavis")
eval(parse(text = script))

Fork and clone a plethora of public data, code, material

But why?

Reproducible

Unlimited

Transparent

Shareable

Best practice for file management

Annotation

N <- 20  # set rep number  
p <- rep(rnorm(100), N)  # repeat a random normal dist of 100 integers N times  

Disclaimer

This is a git GUI tutorial and not the best way to use git.

   

I'd rather you move towards open-access and reproducible research than be deterred by the git user experience.

 
 

See Part II

Initialising and using your repo

1. Create a local repo

2. Add your files

3. Upload changes to a remote Github repo

1. Create a local repo

  • Initialise a local repository (repo) in your folder [git init]
  • Repos are directory-specific and log info for that directory

2. Add your files

  • Stage (add) your files [git add]
  • Commit your files to a git (backup) [git commit]

3. Upload changes to a remote Github repo

Now we push [git push] the changes we made from our local repo to our Github cloud.

  1. Create a new Github repo. Name it using best practice, e.g. no spaces
  2. Don't create a README
  • Uncheck the box 'Initialise this Github with a README'

3. Upload changes to a remote Github repo (cont …)

1. Go to the repo loading page on your Github

2. Drag and drop the file/s onto the screen

3. Add a commit message, e.g. 'init' 'updated table2', etc

That's it!

Your data is now stored and version controlled
in local and remote repos

Cloning an existing repo

Clone a remote repo to your local computer

This creates a git repository on your local machine complete with version control.

   

Why clone?

You can dump the contents of any public repo, including its complete version history, onto your own computer, then upload it onto the cloud.

Part II

using git from the command line

Why use the command line?

- Complete control and ease of workflow

- Transparent history

- Automate your commands, e.g. schedule an automatic daily backup

- A steeper learning curve, but worth the investment

Workflow example

Open an '.Rproj' with self-contained files

Use the R Studio in-built command line connected to your Github

Backup straight from R

Cake!

References