1.3 - Version control

git add
git commit
git diff
git log
version control
  • Recognize the commit as the primary building block for storing a project version
Published

January 27, 2023

Why teach this?

  • How to introduce the topic? Most of the Git courses start by saying that Git is the tool that will help you to track the history of your project and version control your files. But, what does that mean?*

When we start a class it is common to use an engaging real-world example to demonstrate the utility of the tool are you about to teach. For example, you might start a Git lesson with a picture such as this:

Do you have problems saving different versions of your files?

What’s important is to map the concrete example with the sequence of commands and terminology needed to explain during the class. If we move from this picture directly to explain a sequence of the commands, it will not be necessarily evident how Git can help us with the reproducibility. We should explain the analogy in full detail.

Revisiting the analogy at the end of the class could be a a good strategy to reinforce these connections after the topics

  • Understanding how Git controls the different file versions could be a good starting point to introduce git diff <commit1-HASH> <commit2-HASH> and complement it with git log.

Mental model

Activities

I consider activities about version control not only the ones about the workflow

References

The image in this chapter T The Turing Way project illustration by Scriberia. Used under a CC-BY 4.0 licence. DOI: 10.5281/zenodo.3332807.