Enregistrer un point de sauvegarde (commit)
Cette leçon est affichée en anglais, car elle n'a pas encore été traduite.
Draft: this lesson is an outline and will be expanded.
A commit is a checkpoint: a snapshot of your whole project at one moment, with a short message saying what changed. If an AI helper changes your files and something breaks, you can return to your last checkpoint. That makes it safe to try bold changes, so the habit to build is simple: save a checkpoint before you ask the AI for something, and again whenever you are happy with the result. In this lesson you will make your first checkpoints.
What you will do
- Open your practice project in a text editor, and change the README. Add a sentence about what the project is for.
- Switch to GitHub Desktop. It lists the changed files and shows the changes: the lines you added are marked in one colour and the lines you removed in another.
- Write a short message that says what you did, such as “Describe the project in the README”, and save the checkpoint. This is the commit.
- Ask your AI helper to add a new file, for example “Create a file called
ideas.mdwith a list of three project ideas.” Look at the files the app now shows as changed. Read every change before you keep it. - If you like the result, commit it with a message of its own. If you do not, discard the changes in the app, which returns the project to your last checkpoint.
- Choose the option to send your checkpoints to GitHub, called pushing, so the online copy matches your computer.
Safety note: check the list of changed files before every commit. If you see a file with passwords or keys, do not commit it. Ask your AI helper how to keep it out.
Check yourself
- Your History view shows at least two commits with clear messages.
- You discarded one change on purpose and saw the project go back.
- The commits are visible on the GitHub website after pushing.