Version control with Git and GitHub

 Initial tasks:

  1. Please sit near the front (saves my voice and you'll hear better)
  2. Log in to a PC
  3. Open this slideshow at https://slides.com/gcapes/git
    • The course notes are linked from this slideshow
  4. Sign up for a GitHub account

 

Note there is no sign-in sheet. Attendance is recorded using feedback form.

Gerard Capes, Research IT

Research-related IT Services

Described on IT Services website.

Announcements given via Research IT blog.

  • Training courses teaching computing skills for Research
  • General guidance and advice about research software
  • Access to specialist support and consultancy e.g. code reviews
  • Access to HPC systems
  • Data storage and management
  • Full list of services on offer

For help and support use the Support Centre

Housekeeping

  • Fire exit
  • Toilets
  • Course timing
    • 09:30 -- 12:00
    • 12:00 -- 13:00 lunch
    • 13:00 -- 16:00 

Teaching methods

  • Interactive workshop-style course
    • Type along with the examples
    • Test your understanding in the exercise sessions
  • Course notes
    • All examples and exercises are in the notes
    • Slides will remain online after the course

Getting help

  • Sticky notes
    • Used for getting help and giving real-time feedback
    • Green = OK / ready to go
    • Red = not OK (too fast, didn't understand, computer says no etc)
  • Please interrupt me to ask questions
  • Peer learning
    • During exercises, please help each other as required
    • Please try to be quiet during worked examples so everyone can hear

What is a version control system?

  • Version control is a piece of software which allows you to record and preserve the history of changes made to directories and files.
  • If you mess things up, you can retrieve an earlier version of your project.

Have you been here before?

  • Save a copy elsewhere?
  • Save with a different name?
  • How do you name different versions?
  • What's different between them?
  • Many copies of nearly-identical but critically different files

Storing versions without VCS

Why use version control?

To store versions properly

  • VCS treats files as one project - one current version on disk, previous versions and variations saved in the repository
  • VCS starts with a base version of the project, and only saves the subsequent changes you make
  • In order to save a new revision, a commit message is required, which explains why the changes were made

Changes are saved sequentially

Different versions can be saved

Multiple versions can be merged

  • Restore previous versions
  • Understand what happened
  • Backup
  • Collaboration

Why use version control?

  • Example scenario
  • Text files vs binary files
  • Git vs GitHub

Before we get started

Open the notes

Understanding the commands

The staging area

Checking out a previous commit:

"detached HEAD"

Branches

Revert: create a new commit

Reset: delete commit(s)

Exercises on remote collaboration

3 exercises at the bottom of this page:

http://gcapes.github.io/git-course/09-remote-collaboration

Feedback form = attendance

Link to feedback form

Rebasing

Merge vs rebase

Standard merge

Rebase onto master

(FF) Merge after rebase

Forks and Pull Requests

git

By gcapes

git

Slideshow to support Git training course

  • 1,919