Non-FictionInformativeEducational
Version Control with Git and GitHub eBook
A Coursebook on Version Control with Git and GitHu
by Milner Libby
A Coursebook on Version Control with Git and GitHub
Formats
Free sample
Chapter 1: The Blank Screen...--–- The cursor blinks on a blank terminal. It is 11:47 PM. Sarah, a talented but exhausted developer, has just spent the last four hours building a new authentication feature. The code works. The tests pass.
She types rm -rf node_modules to clear some space before pushing to the server. Her finger slips. She adds a space. rm -rf / node_modules. The command begins to execute.
By the time her brain catches up to her fingers—by the time she smashes Ctrl+C—it is too late. Her entire project is gone. Not just the new authentication feature. Everything. All of it.
The cursor blinks on a blank screen.This is not a horror story. This is a Tuesday. Version control exists because stories like Sarah’s happen to real people every single day. Not always from a mistyped deletion command—sometimes from a corrupted hard drive, a colleague who saved over the wrong file, an automatic update that broke everything, or simply that moment of realization: "I changed something three hours ago, and I cannot remember what, but the tests stopped passing and I cannot go back." If you have never experienced this sinking feeling, you will. The only question is whether you will have version control in place when you do.The Fundamental Problem That Most Developers Ignore Before we write a single Git command—and we will write many in Chapter 2 onward—we need to understand the problem that version control solves.
Not the technical problem. The human problem. The problem is this: software development is an activity that produces an irreversible sequence of changes. Every time you save a file, you destroy the previous version. Every time you delete a line, you cannot undelete it unless you remember exactly what it said.
Every time you refactor a function, the old function disappears into the ether.You might think, "But my text editor has undo!" Yes. And undo works exactly until you close the editor, or until you make too many changes and the undo buffer fills, or until you do something that the editor does not track, like renaming a file. Undo is a temporary bandage, not a systemic solution. You might think, "But I save backups!" Yes. And backups are great for disaster recovery when your hard drive dies.
But backups are cumbersome for the everyday reality of development: "I want to see what this file looked like three hours ago, before I started refactoring, but I do not want to restore the entire backup—I just want to peek at that old version and maybe bring back a single function."What developers actually need is a system that remembers every version of every file, forever, and makes it effortless to move between those versions, compare them, undo changes selectively, and understand how the code arrived at its current state. This system must work offline (because you will be on a plane or a train or a coffee shop with no Wi-Fi). It must work for a single developer working alone and for a thousand developers working together. It must be fast, reliable, and, above all, trustworthy.This system exists. It is called Git.A Brief History of "Oops" – Why We Needed Version Control To understand why Git works the way it does, it helps to understand what came before.
Version control did not spring fully formed from the forehead of Linus Torvalds (the creator of Linux, who wrote Git in 2005). The history of version control is a history of people repeatedly discovering that they needed better tools, and building them, and then discovering the limitations of those tools, and building again.The Local Era (RCS, 1982)The first version control systems were local. The most famous was Revision Control System (RCS), released in 1982. RCS stored a directory called RCS next to your working files. Inside that directory, for every file you wanted to track, RCS stored a "delta" file containing the differences between versions.
You could check out a file, edit it, and check it back in. RCS kept track of each version, who made it, and when.For a single developer working alone on a small project, RCS was a revelation. You could finally undo mistakes. You could see what changed last week. You could maintain multiple "branches" of a file (though branches in RCS were heavy and awkward).But RCS had a fatal limitation: it was local.
You could not collaborate. If two developers tried to work on the same file, they would overwrite each other's changes. RCS did not know about networks, servers, or teams. It was designed for a world where one person worked on one file at a time.The Centralized Era (CVS, Subversion, 1990s)The next generation solved the collaboration problem by introducing a server. Centralized Version Control Systems (CVCS) like Concurrent Versions System (CVS) and later Subversion (SVN) put a single, authoritative repository on a server.
Every developer would "check out" a working copy from that server, make changes, and "commit" those changes back to the server. The server tracked history, managed conflicts, and served as the single source of truth.For teams, this was transformative. Suddenly, multiple developers could work on the same project. The server could merge their changes automatically (most of the time). You could see who changed what and when.
You could revert a bad change across the entire project.But the centralized model introduced a new vulnerability: the server is a single point of failure. If the server went down, nobody could commit changes. If the server's hard drive died and the backups were corrupt, history was gone forever. If you were on a plane without internet access, you could not commit, you could not look at history, and you could not even see the difference between your working copy and the last checked-in version. The central server was both the savior and the hostage-taker.I remember working on a Subversion project in 2008 when the server's hard drive failed.
The team had not backed up the repository. We lost six weeks of work. Six weeks of commits, bug fixes, features, documentation—gone. Because we had only one copy of history, and it was on a spinning disk that gave up. That experience, shared by countless developers across the industry, created the demand for something better.The Distributed Era (Git, 2005)In 2005, Linus Torvalds was running into the limits of the existing tools.
The Linux kernel project involved thousands of developers spread across the world, making tens of thousands of changes per week. The project had been using Bit Keeper, a commercial distributed version control system, but when the company behind Bit Keeper revoked the free license, Torvalds needed a replacement. He looked at existing open-source options. He found them all lacking.So he wrote his own. In two weeks.
(Do not try this at home. Linus Torvalds is not a normal human.)Git was designed from the ground up with a different mental model: every developer has a complete copy of the entire repository, including all history. There is no central server that holds the "real" history. There are only repositories, each of which is a peer. You can designate…
This is the end of the free sample. Get the eBook to keep going. Buy now
About this book
Details
- Author
- Milner Libby
- Publisher
- SamEnrico
- Language
- English
- Genre
- Non-Fiction, Informative, Educational
- Released
- 2026-06-03
- Pages (approx.)
- 147
- Available as
- eBook, Audiobook
Read better in the ZLOADR app
Your eBooks on your phone or tablet. Sign in with your SamEnrico account and start reading.
More by Milner Libby
Small Talk for Sports EventsMilner Libby$11.99
Napping for Traumatic Brain InjuryMilner Libby$11.99
Pain Meditation Cheat SheetMilner Libby$11.99
The Oral Fixation SubstituteMilner Libby$11.99
Jumia Viral Listing GuideMilner Libby$11.99
Spin Class Etiquette GuideMilner Libby$11.99
The Farm Labor Slavery EscapeMilner Libby$11.99
Boundary Setting For SalespeopleMilner Libby$11.99
Sleep After Child LossMilner Libby$11.99
Whispers of the First Fleet: The Unheard Voices of Australia’s ArrivalMilner Libby$11.99
The Great Space Race: How a School Project Launched a Rocket to the MoonMilner Libby$11.99
The Golden Roads of Aksum: Africa's Ancient Silk RouteMilner Libby$11.99You may also like
Hong Kong Handover 1997Dunn Johnnie$11.99
Zumba For Postnatal Recovery CourseNeal Christian$11.99
Zumba for BeginnersLadner Nikia$11.99
YouTube Comment Mining GuideHumes Pandora$12.99
Worry Box MeditationCarlin Rudy$11.99
Workplace Stress MeditationNguyen Lynn$11.99
Workplace Stress and Sleep RepairHawley Ivory$11.99
Workplace Perfectionism CureDelaney Jeffry$11.99
Workplace Injustice Anger GuideWallen Isabelle$11.99
Work Addiction and Burnout LinkGreenwood Ester$11.99
Women in Yoga and WellnessBeattie Galina$11.99
Women in Stand Up ComedyChun Evangeline$11.99