Git & GitHub training

Introduction to Git / GitHub

Julien LEBRANCHU

January 30, 2024

Presentation of the Git software

What is Version Control Software (VCS)

Git is Version Control Software

Version control - also known as source control or revision control - is an software development practice for tracking and managing changes made to code and other files.

VCS improves the following factors:

  • Collaboration
  • Storing Versions
  • Backup

What is Version Control Software (VCS)

Centralised vs Distributed

What is Git ?

  • The most popular Distributed Version Control Software (VCS)
  • Git was originally authored by Linus Torvalds in 2005
  • Free and open source software
  • Light and local use (without the internet)
  • Manages and tracks versions of a project (code, manuscript, data)
  • Can be linked with a remote server (GitHub, Gitlab)

What is Git for ?

For a single user

  • Track changes (commits) over time with information about when and what are the changes
  • Eventually go back in time
  • Synchronise the project in the cloud with git servers (GitHub, Gitlab)

What is Git for ?

For a collaborative project

  • Track changes (commits) with information about who, when and what are the changes
  • Resolve version conflict when simultaneous changes
  • Highlight a specific version of the project (tags)
    • A new version of a software
    • Submitted, revised versions of a paper
  • Create derivatives of a project (branches):
    • Main
    • Chapter-1
    • Chapter-2
    • Chapter-N
  • Publish the project (open science)

What is Git for ?

Example of branches

Presentation of GitHub

What is GitHub Inc.?

GitHub is a web-based hosting service for version control using Git.

What is GitHub Inc.?

GitHub is a web-based hosting service for version control using Git.

  • Access to the control and collaboration features for every project.
  • Work with public and private repositories.
  • Develop networking.
  • Source of information.
  • Allows to host personal websites
  • Continuous integration using GitHub Actions

Example: T3 repository

Presentation of repository

Example: T3 repository

Branch interfaces

Example: T3 repository

Issue interface

Example: T3 repository

GitHub actions

Go further in Git

Git architecture

  • Workspace: your working directory \(\rightarrow\) your computer
  • Local: the local repository \(\rightarrow\) contains the history of your project
  • Index or Stage: a buffer between Workspace and Local \(\rightarrow\) the list of files to be committed

Command:

  • add: the command to add the file(s) to the list of tracked files
  • commit: the command to validate a version

Git architecture

  • Workspace: your working directory \(\rightarrow\) your computer
  • Local: the local repository \(\rightarrow\) contains the history of your project
  • Index or Stage: a buffer between Workspace and Local \(\rightarrow\) the list of files to be committed
  • Remote: the remote directory \(\rightarrow\) Source of truth (shared by all)

Command:

  • push: Update remote refs along with associated objects

Git architecture and command transport

Command:

  • push: Update remote refs along with associated objects
  • fetch: Download objects and refs from another repository
  • rebase: Reapply commits on top of another base tip
  • pull: Fetch from and integrate with another repository or a local branch

Good practices

  • Pull before any work on the project
  • Commit as frequently as possible
  • Write explicit commit message
  • Push regularly

R/Git/GitHub && Sources

Go further

Sources