Save points with Git and GitHub
Every working step deserves a save point you can return to, and a copy that lives somewhere safer than your laptop. This lesson connects your project to GitHub, shows you how to commit and push without typing Git commands, and how to undo a bad change in a minute.
By the end you can
- Explain repository, commit and push in plain words
- Create a private GitHub repository and push your project to it
- Keep secrets out of the repository, and know what to do if one gets in
- Undo a bad change with a revert, and use a branch for a risky one
The everyday picture
Think of a video game with save points. Before the hard level you save, so that if it goes badly you restart from there instead of from the beginning. Now imagine every save also went into a fireproof safe across town, with a note saying what you had just done.
Git makes the save points on your laptop. GitHub is the safe across town. The note is the commit message.
Three words: repository, commit, push
- A repository (repo) is your project folder plus its whole history.
- A commit is one save point with a message, such as "Recipe pages".
- A push sends your new commits to GitHub.
Commits stay on your laptop until you push. In lw-05, every push to GitHub will also make Vercel build a new version of the live site, so a push is the moment a change starts heading to visitors. Next.js's setup command already made the first commit for you.
Quick check
You made three commits today but didn't push. Your laptop dies tonight. What is lost?
Commits live on the laptop until a push copies them to GitHub. That is why you push at the end of every working session.