Git and saving your work
Stop building straight on the live site
Every change goes to main and straight to production, tested by your users.
- What you get
- A simple routine: a branch per change, a preview link, then merge.
- Paste it into
- Your AI tool, in your project
The prompt
Right now I push every change straight to the live site. Set me up with a safer routine that's still simple for one person. Look at how this project deploys. Then set it up so the main branch always matches what's live, each change happens on its own short-lived branch, the host builds a preview link for that branch, and I merge only after checking the preview. Add a check that runs the build, lint and tests before a merge, if the repository host offers that for free. Write the routine as six lines in the README with the exact commands. Tell me the settings to switch on in my host and repository dashboards.
Use it
Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in.
More in Git and saving your work
Save versions you can find your way back to
One giant commit called “update” holds a week of work.
Get out of a Git mess without losing work
Conflicts, a detached HEAD or a rejected push, and every suggested command looks dangerous.
Go back to the last version that worked
The last hour of changes made things worse and you want it gone.
Stop committing files that shouldn’t be in Git
The .env file, node_modules or build output ended up in the repository.