game_FINAL_v3.js

Play this lesson

game_FINAL_v3.js

Kai and Remy knew the AI could break things, so they kept backups the simple way: copying the file before each big change.

Now the Hyper Shards folder holds game.js, game_v2.js, game_FINAL.js, game_FINAL_v3.js, game_FINAL_v3_REAL.js and game_old_WORKS.js.

Which one is the newest? Which one actually works? Nobody is sure.

Why copies fail

Find the latest

Hyper Shards folder
Name                 Date modifiedgame.js              12 Marchgame_v2.js           19 Marchgame_FINAL.js        2 Aprilgame_FINAL_v3.js     28 Marchgame_old_WORKS.js    5 April

Kai needs the copy that was saved most recently. Which file is it?

  1. game_FINAL.js
  2. game_FINAL_v3.js
  3. game_old_WORKS.js
Show the answer

game_old_WORKS.js

The dates show game_old_WORKS.js was saved last, even though its name says old. Names mislead, and even dates only tell you when a file changed, not what changed or whether it works.

The AI made a big change

Last month, Remy asked the AI for a new boss fight. It changed about 40 lines spread across game.js. Remy played it, and the game crashed at wave 3.

What exactly had changed? Remy had already closed the editor, and in most editors the undo history is gone once the editor app is closed. No copy had been made that morning. Getting the working game back meant hunting for every changed line from memory.

Quick check

The editor's undo button is a good enough replacement for proper save points.

Show the answer

False

Undo only remembers recent changes while the editor is open, and it has no notes. It also can't help a teammate working on another laptop.

Save points, like in a game

In a game, you save before the boss fight. If it goes badly, you load the save and try again.

Code has save points too. A commit is a snapshot of the whole project at one moment. The tool that makes commits is Git, created in 2005 by Linus Torvalds to manage the code of Linux. Today most software teams in the world use it.

What a commit records

A commit stores much more than a copy of the files. It also records:

Read the history

Hyper Shards history
a41f9c0  Add boss fight to wave 3   Remy  Fri9c2e1b7  Fix shield timer           Kai   Thu71b0d3a  Add combo multiplier       Remy  Wed3d88f42  Add pause menu             Kai   Tue

Each row is a commit: its ID, message, author and day. Since Friday, the game crashes at wave 3. Which commit should we go back to?

  1. a41f9c0 Add boss fight to wave 3
  2. 9c2e1b7 Fix shield timer
  3. 3d88f42 Add pause menu
Show the answer

9c2e1b7 Fix shield timer

9c2e1b7 is the last save point before the crashes started, so it keeps Thursday's shield fix and Wednesday's combos. Going back to 3d88f42 would throw away good work for no reason.

Quick check

What does a commit give you that a copy called game_FINAL.js doesn't?

  1. A message, an author, a time and the exact lines that changed
  2. A smaller file that loads faster
  3. Protection from every possible bug
Show the answer

A message, an author, a time and the exact lines that changed

A copied file is just a copy. A commit is a labelled snapshot in a history you can read, compare and go back to.

GitHub keeps it safe

Git keeps the history on your computer. GitHub is a website that stores a copy of it online, in a repository (repo for short): the project's files plus their whole history.

If a laptop breaks, the code is safe. And Kai, Remy and you share one history instead of three folders full of copies.

True story: Toy Story 2 nearly vanished

Around 1998, Pixar was making the film Toy Story 2. One day, Oren Jacob, who worked on the film's technology, watched the folder of Woody's files shrink on every refresh. A stray command was deleting the film. About 90% of it was gone.

Then the backup tapes turned out to be broken. But Galyn Susman, the film's supervising technical director, had been working from home after having a baby, and her computer there held a copy, about two weeks old. They wrapped it in blankets, drove it to Pixar and rebuilt the missing files from it.

A copy in another place saved the film. For our code, that place is GitHub.

Source: The Next Web: how Toy Story 2 was deleted twice (interview with Oren Jacob, 2012), thenextweb.com

Bolt says: We set up Git and GitHub in Stage 2. Next: the last disaster, saves that vanish.

Fact-checked 11 October 2026