CodeRefinery workshop on version control

Teaching researchers in sustainable software development

September 22-23, 2020

Registration is closed

Contact

kthw@kth.se

Format

Hands-on informal and interactive two-day event with type-along type of presentations, live coding and demos. Short tutorials alternate with practical exercises.

Software requirements

Please follow the links below and make sure that you install all the required software packages (why we ask you to do this). Note that, e.g., a working Python executable on your laptop is not sufficient - a version greater than 3.4 is strongly recommended and a number of extra packages need to be installed as detailed on the Python installation page.

Schedule

Day 1 Day 2

Location

Online Zoom room

Time

9:00 - 17:00

Price

Free of charge.

Course goals

The aim of this course is to demonstrate to and familiarize the workshop participants with best practices and tools in modern research software development. The main focus is on professional tools for efficiently writing and maintaining research software. Since most research code is developed in a collaborative setting, we will discuss tools and workflows which facilitate this process. Most of the content is also relevant to a single researcher.

Who the course is for

Are you doing any of these things below:

  • You write scripts to process data.
  • You change scripts written by your colleagues.
  • You write code that is used in research by you or others.

If yes, then this course is for you. Most participants are not "professional code developers" or computer scientists.

If you develop research code and you know all the tools already, join us as a helper! It's fun, and you always learn something new about a subject by teaching it.

What we will not teach

This is not a course about a specific programming language or the Linux/Unix terminal shell. We assume that you are familiar with the programming language that you use in your work and research. We try to keep the course as language-independent as possible but we will show some basic code examples in Python.

Prerequisites

  • You should be able to navigate the file tree in a terminal session and edit text files in the terminal. This Linux shell crash course contains the essentials.
  • Basics in one or more programming languages.
  • You will need to bring a laptop.
  • It is good if you have access to Eduroam.
  • You need to install some software. Please follow links in the schedule.
  • It is useful if you have a basic idea of how Git works. We will start from the basics, but please go through this Git-refresher material for a basic overview and important configuration steps.

Instructors

  • Raphaela Heil
  • Thor Wikfeldt
  • Pavlin Mitev

Helpers

(tips for helpers)

  • Diana Iusan

Questions and answers

Git introduction

  • Is it possible to add a file and commit it at the same time?
    • yes, with the -a option to git commit ! E.g. git commit -a -m <msg>
    • note: new files will be ignored with -a
  • Should .gitignore be part of the repository or not?
    • yes, so that everyone has the same experince / practice
    • also when you yourself are using different computers, you want git status to show the same output regardless
  • How can one remove a file alltogether from the stage?
    • try it! do a change, stage it, and type git status - it tells you what to do.
    • git reset -p or git reset $file (staging area)
      ref. https://coderefinery.github.io/git-intro/05-undoing/
  • What about adding a directory to the stage? How are the files within treated?
    • actually, it’s impossible to stage only the directory, git works only with files. What you would do is to stage a file within a directory. If you for some reason really need to add an empty directory to a repository, the convention is to add an empty .gitkeep file in that directory
    • but if you have a directory with many files you can do git add dirname and all the files within get staged
  • when forgetting to include a comment with a git commit, the editor opens. I’m not sure what to do with this, write out does not seem like the best option, but I don’t see anything else that makes sense.
    • ah yes, is it an editor you’re not familiar with? if you’re on linux or macos it could be that the vim editor opens by default. vim is tricky but you can set another editor to be the default (https://coderefinery.github.io/installation/git/#configuring-git). To exit vim, type :q
      • but opening an editor like this is useful if you want to write longer commit messages: start with short summary on line 1, then longer explanation on line 3 and below
  • The fact that the .DS_Store shows up as untracked file on a Mac I guess is because I have opened the directory from the GUI?
    • yeah I think Finder on macos creates these .DS_Store files. I think it makes sense to ignore this file in your .gitignore
  • In the event that someone has not had their coffee yet and accidentally starts their day with “git init”,is past work lost and is pulling from the server the only way to recover the previous work?
    • this is safe and will not overwrite things that are already there

Collaborative Git

  • any ideas as to why github uses “pull request” when it involves pushing rather than pulling?
    • I believe the terminology is based on the point of view of the master branch -> you are requesting the master branch to pull your changes
  • How can a team lead create issues for other collaboraters?

About

CodeRefinery is a project within the Nordic e-Infrastructure Collaboration (NeIC). NeIC is an organisational unit under NordForsk.

GitHub and Twitter