Skip to content

Latest commit

 

History

History
204 lines (132 loc) · 6.08 KB

03_gitSlides.md

File metadata and controls

204 lines (132 loc) · 6.08 KB
title author date output
Welcome to the Wonderful World of `git`
Simon Goring
23/10/2020
revealjs::revealjs_presentation
theme css transition self_contained reveal_options reveal_plugins
simple
../templates/custom.css
fade
false
slideNumber previewLinks
true
true
notes

Working a Little git at a Time

  • git is version control
  • Each change is recorded, all past versions are retained
  • One version always works (more or less)

What People Really Think

"git really changed the way I write code. I stopped making a whole bunch of huge changes, and started working on one thing at a time. It's made fixing my code a lot easier, and I don't run into problems as often."

Simon Goring (when I'm feeling optimistic)


Version Control


Basics of Version Control

  • Changes to files are important and done with purpose
  • We record changing files and the reason for these changes
  • Changes may not always be wanted; we want to undo unwanted changes
  • We want a clear way to collaborate and understand when changes conflict.

Basics of Version Control - Vocabulary

  • A project that is managed with version control is called a repository
  • Each snapshot of the repository at any one point is called a commit
  • A repository can have multiple versions of the same code, called branches
  • There is generally a main branch (see GitHub's explanation for deprecating master)
  • New features often get their own branch until they are ready to be added to main

Basics of Version Control - Tools


Tool for Working with git


Using git


git Workflow

  • Initialize (set up the infrastructure)
  • Edit your code/document &cetera
  • Stage the changes before we commit the changes
  • Commit the changes to git

A diagram of commits & stages for git.

Source: sublimegeek

Local git Workflow

  • git init - Initialize a repository
  • Make changes
  • git add to stage changes
  • git commit to commit changes

Starting from Scratch (with RStudio)

Check your version.

simon@partyLaptop:~$ git --version
git version 2.25.1
simon@partyLaptop:~$

Create New Project (RStudio)

simon@partyLaptop:~$ git init

Using RStudio


GitHub & Online Repositories


Public Code Repositories


Range of Options


A Repository for Home and Away - Naming It

  • Your remote repository is the main version and the origin
  • remote is the backup, the collaboration hub & the authority
  • local is where you work on things


A Repository for Home and Away - Getting It

  • You can fork someone else's repository to your account
  • You can clone someone else's repository (or your own) to your local computer
  • You can create a new repository

Fork and Clone


Fork and Clone (Active)

  • Create new Project in RStudio "From Version Control"
  • All files copied locally. Fun times!!

What Makes a Good Repository


What Makes a Good Repository (Discussion)

  • Active discussion