Version Control – Why, When, and When Not (Part II)

10 minutesModule: Version Control – Why, When, and When Not (illustrated with Git)

Prefer reading? The full written version is below

Note: This is the written companion to the video above. Same content, optimized for reading – so you can watch, read, or both, depending on how you learn best.

Here we look at when you should use version control and when you should not.

When to use version control, in brief

Version control systems like Git shine on text files that are human readable, such as code or documentation. For plain text files, Git can track file changes line by line and easily tell you what changed, when, and possibly why. For anything else you will want to consider other tools.

Typical examples when you need something else besides or even instead of Git

Large binary files

Large binary files – images, videos, executables, and many PDFs – are a typical example where Git is not ideal. While Git can store such files, at least up to a certain file size limit (like 100 MB in the case of GitHub), Git does struggle with storing binary files efficiently. This happens because binary files appear as long streams of bytes with no structure – unlike text files, which are made of clear, readable lines, where compression works well (since Git can usually understand what changed line by line and store only those changes). If you change and commit binary files frequently, your repository size can grow quickly and operations will slow down. For this reason, it is better to use an additional tool alongside Git, such as Git Large File Storage (Git LFS), which is designed to handle large binary files more efficiently.

Research outputs

When it comes to research outputs, these come in many formats, and you will want to handle them differently in Git.

Text‑based sources (LaTeX)

Text‑based sources like LaTeX files work well with Git, but LaTeX also produces output files, such as PDFs. Because these output files are recreated every time you compile your TeX files, generated files should not be put under version control; you can always recreate them from the LaTeX source. For collaborative writing, such as drafting a paper together, an online LaTeX editor can sometimes be more convenient.

Word documents and similar

Word documents and similar formats may look like text to you, but for Git they behave like binary files. Git can store them, but will only show you a file changed instead of which line in the file changed.

Jupyter notebooks

Jupyter notebooks can be kept in Git, but they behave differently from plain text files because they can store more than just code and text. In particular, they save the outputs produced when you run the code. These outputs change every time you run the notebook, which leads to large and messy changes. For this reason, notebooks require extra care, such as removing embedded outputs before committing.

Datasets and databases

Datasets and databases are also part of research output, but large or frequently changing data should not be stored directly in Git. For datasets, dedicated data-versioning tools or external storage are usually a better fit, while databases require their own backup and management strategy entirely.

Sensitive or private data

Sensitive data – credentials, patient records, and similar private information – do not belong in repositories, especially not in remote repositories.

We will explore such topics in more detail later on.

Version control is NOT a backup

It’s important not to mistake version control for backup, even if remote repositories do give you some backup-like properties (since you have files that exist remotely and which you can recover if your own machine dies). But a remote repository is still not a full backup. For instance, it only knows what you stored from your project, which means it does not know about files you forgot to add or did not intend to add in the first place. It also doesn’t know about work you haven’t committed and pushed yet.

Quick rule of thumb

If it is plain text, changes over time, and a person needs to make sense of those changes, then it’s probably something that belongs under version control. Whether you put it under version control or not, make sure you also have a reliable backup. Next, we will look at the basic local Git workflow in more detail.