Inhaltsverzeichnis

Introduction to Git and GitHub for Musicology Editorial Work

Why this matters

In digital musicology, we often work with files that change over time:

A common problem is that files get copied, renamed, emailed around, or stored as:

This quickly becomes confusing.

Git helps us keep a structured history of changes. GitHub makes it easier to synchronize work between computers and collaborate with others.

For musicological editorial work, this is especially useful because:

Learning goals

After this introduction, students should be able to:

What is Git?

Git is a version control system.

This means it records the history of a folder and its files over time.

With Git, you can:

Git is not only for programmers. It is useful for any research project where files evolve over time.

What is GitHub?

GitHub is a web platform built around Git.

Git itself works on your computer. GitHub adds:

A useful short formula is:

Core concepts

Repository

A repository (or „repo“) is a project folder managed by Git.

It contains:

Commit

A commit is a saved snapshot of your work.

A commit should record a meaningful step, for example:

GitHub remote

A remote is an online copy of your repository, for example on GitHub.

This lets you:

Push and pull

Branch

A branch is a parallel line of work.

Branches are useful when:

Why Git is useful for OMR and MEI editorial work

Git works especially well when files are text-based.

MEI files are XML, so Git can track line-by-line changes very well.

This means Git can help you see:

Important limitation: binary files

Git works best with plain text files:

Git works less well with large binary files such as:

This does not mean you cannot store such files in a repository, but:

Installing Git

What is needed:

For long-term understanding, command line Git is better. For quick adoption, GitHub Desktop may be easier.

Mei-friend has a sophisticated GitHub integration which we'll probably use most of the time, but git syntax is universally usable in all tools/environments.

First-time Git setup

After installing Git, set your name and email in the terminal:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.org"

This identifies your commits.

Check the configuration:

git config --global --list

Starting a repository

Move into your project folder:

cd path/to/music-edition-project

Initialize Git:

git init

Now Git is tracking this folder as a repository.

Checking repository status

The most important command for beginners is:

git status

This shows:

Students should get used to running git status very often.

Adding files

To prepare all current changes for a commit:

git add .

To add one specific file:

git add data/mei/motet_01.mei

Making a commit

After adding files, save a snapshot:

git commit -m "Corrected note durations in motet_01"

A good commit message is:

Good examples:

Bad examples:

Connecting to GitHub

Create an empty repository on GitHub.

Then connect your local repository to it:

git remote add origin https://github.com/USERNAME/REPOSITORY.git

Check that the remote was added:

git remote -v

Uploading your work to GitHub

If your main branch is called main:

git branch -M main
git push -u origin main

After that, future uploads are usually just:

git push

Downloading changes from GitHub

Before you start working, download any new changes:

git pull

This is especially important if:

A minimal daily workflow

git pull
git status
git add .
git commit -m "Describe the editorial change"
git push

This can be explained as:

Collaboration basics

When multiple people work on one repository, Git can help organize collaboration.

A simple shared workflow:

For slightly more advanced collaboration, use:

Branches for safer experimentation

Branches are useful when you want to try something without changing the stable version.

Example uses:

Create a new branch:

git checkout -b revise-source-A

Work and commit as usual.

Later, the branch can be merged into the main branch.

Merge conflicts

A merge conflict happens when Git cannot automatically combine two competing changes.

Example:

This is normal and not a disaster.

The usual solution is:

  1. inspect the conflicting file
  2. decide which reading to keep
  3. edit the file manually
  4. save the corrected version
  5. commit the resolution

For beginners, the best prevention is:

GitHub features that are useful for editorial projects

Useful GitHub features include:

Issues

Use issues to track:

Pull requests

A pull request lets someone propose changes before merging them.

This is useful for:

History and blame

GitHub also allows you to inspect file history and see who last changed a line.

This can be very helpful when asking:

Glossary

Term Meaning
Git Version control system
GitHub Online platform for hosting Git repositories
Repository A project folder tracked by Git
Commit A saved snapshot of changes
Push Upload local commits to GitHub
Pull Download changes from GitHub
Branch A separate line of development
Merge Combine changes from different branches
Conflict A situation where Git cannot automatically combine changes