Introduction to Version Control

Marvin Ludwig

git

Why Version Control?

Get git

git Workflow

git init    # to start
git status # to get infos

git add    # to add files to the tracking system

git commit # to define changed files as the new standard

Git Branches - The Tree Model

https://bluecast.tech/wp-content/uploads/2019/09/git-switch-branch

git branch # to create a new branch

git switch # to switch between branches

git merge  # to merge two branches together

.gitignore

.Rhistory
/data/
*.tif

GitHub

GitHub

Additional Features

Overview

https://miro.medium.com/max/700/1*9qX9F9MGsWKfcmgTOR9BPw.png

Rstudio Integration

Rstudio is a powerful user interface for git!

Real World Example: R packages

https://github.com/HannaMeyer/CAST

Package Page created with pkgdown

install.packages("CAST")

devtools::install_github(repo = "https://github.com/HannaMeyer/CAST")

remotes::install_github(repo = "https://github.com/HannaMeyer/CAST")

Package Page created with pkgdown: https://hannameyer.github.io/CAST

Real World Example: Bugfix

There is a small Bug in the r-package getSpatialData

https://github.com/16EAGLE/getSpatialData

In the file R/internal_clients.R Line 40:

# wrong:
lapply(uuid, function(x) content(.get(paste0(cred[3], "/odata/v1/Products('", x, "')/", field), cred[1], cred[2])))

# correct:
lapply(uuid, function(x) content(.get(paste0(cred[3], "odata/v1/Products('", x, "')/", field), cred[1], cred[2])))

Which workflow do you propose?

Real World Example: Publications

All computations were done in R (Version 4.0.2; [38]). All presented methods are provided as the R-package uavRmp (https://gisma.github.io/uavRmp/) and the Metashape Python Scripts (https://github.com/envima/MetashapeTools). - Ludwig et al. 2020


The ELC10 dataset is available here: https://doi.org/10.5281/zenodo.4407051 JavaScript and R code to reproduce ELC10 is available here: https://github.com/NINAnor/ELC10 - Venter et al. 2021

GitHub Pages

Github can serve webpages!

Contents of docs/index.Rmd

---
title: "Introduction to Version Control"
author: "Marvin Ludwig"
output: html_document
theme: slate
layout: page
---

# Github Pages Demo

This is a demonstration for a simple but effective webpage on Github.

Click [here](presentation.html) for a presentation about git and Github.

Include Large Files

Track large files by including them with text-based pointers

outs:
- md5: 13ff4c5c6672752b90da533b408d0024.dir
  size: 1416965813
  nfiles: 13
  path: data/sentinel2

Online Learning Ressources

Beginner’s Guide to Git and Github

Youtube Video: University lecture with comprehensive technical explanation

Official Github Ressources: Quickstart Guide