Git for beginners: your safety net

Practice7 min read

Git is a system that remembers successive versions of your project. When working with AI it is like the net under a trapeze: when a change turns out to be a mistake, nothing hits the ground.

Why it matters for vibe coding

An assistant can change many files in a single response. If the outcome is bad, it is hard to return to the starting point without a change history. With Git you go back with one command.

Four concepts to start with

A minimal set of commands

git init # start tracking the project git add . # select the changes to save git commit -m "Working to-do list" git status # what has changed git diff # exactly how it changed git switch -c experiment # a new branch for trying things out

Working rhythm

  1. It works? Make a commit with a short, understandable description.
  2. Ask the model for a change.
  3. Look at the diff, that is, check what was actually changed.
  4. Still works? Another commit. Does not work? Roll the changes back.

How to undo unsaved changes

The command git restore file-name restores a file to its last saved state. Be careful: unsaved changes cannot be recovered afterwards, so first look at git status.

A branch for bold ideas

Before a bigger rebuild, create a new branch. If the idea does not pan out, you simply return to the main one, and the failed experiment stays separate.

Do not commit secrets

Access keys, passwords and files with personal data should not end up in the history. Once saved, they can be hard to remove. More in the texts on risks and privacy.

The model can help here too: ask it to explain each command before you run it. How to build that into your work plan is shown in the text on your first project.