What Version Control Is For
The Folder Full of Copies
You have probably already invented version control. Most people do.
It usually looks like this:
report.txt
report-v2.txt
report-v2-fixed.txt
report-FINAL.txt
report-FINAL-actually.txt
report-FINAL-use-this-one.txt
Nobody plans this. It grows one careful decision at a time. You are about to change something and you are not sure the change is an improvement, so you keep the old version just in case. That instinct is exactly right. The instinct is what version control is built on.
The problem is not the instinct. The problem is that copies are a bad way to act on it.
Where copying breaks down
Look at that list again and try to answer three ordinary questions.
Which file is the real one? report-FINAL-use-this-one.txt claims to be, but so did report-FINAL.txt at the time. The name records how you felt when you saved it, not where it sits in the story.
What changed between two of them? You can open both and read them side by side, slowly, hoping you notice. For six paragraphs of text that is tedious. For six hundred lines of code it is not realistic.
Why did you make that change? This one is usually impossible. The file name has room for a version number and a mood. It has no room for “removed the second paragraph because the numbers in it were wrong.”
That third question is the one that hurts most, and it hurts later, which is why it is easy to ignore now. Six months from now you will find something strange in your own work and wonder whether it is a mistake or a fix you made deliberately. The copies cannot tell you.
It gets worse with another person
Suppose you send report-FINAL.txt to someone and ask them to look at the middle section. While they read it, you fix a typo in the opening.
They send back a file with their improvements. You now have two files. Each one contains work the other is missing. Neither is correct.
Someone now has to merge them by hand, reading both, deciding line by line. If you have ever done this, you know it is slow and you know you got something wrong.
You find notes-v3.txt and notes-v4.txt in a folder from last year. What can the file names establish without opening either file?
What you actually want
Step back from files for a moment and describe what you wanted the whole time. You wanted to be able to say:
Save what this project looks like right now, and let me write down why. Keep every one of those saves. Let me look at any of them later, compare any two, and go back to any of them if I need to.
That is a reasonable thing to want, and it is not what a folder of copies gives you. It is what Git gives you, and the rest of this course is about how.
One thing to be clear about before we go on: none of this is about being disorganized. The copies problem is not a discipline failure that tidier people avoid. Careful, experienced people produce that folder too, because the tool they were using could not do any better. You are about to get a better tool.