Git for beginners: your safety net

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
- Repository: the project folder together with its history.
- Commit: a saved point in the history, like a snapshot of the project's state with a description.
- Branch: a parallel version of the project in which you can experiment without risk to the main one.
- Diff: a comparison of the differences between two versions: what was added and what was removed.
A minimal set of commands
Working rhythm
- It works? Make a commit with a short, understandable description.
- Ask the model for a change.
- Look at the diff, that is, check what was actually changed.
- 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.


