Skip to content

Saving your code

Git saves versions of your product on your computer. GitHub and GitLab keep a copy online, where you change things on a branch, get a review and merge it into main.

Do I need Git and GitHub?

Yes, as soon as you have code you’d hate to lose. Git saves versions so you can undo a bad change, and GitHub or GitLab keeps a copy online.

If your AI tool changes many files at once
Save a version with Git before each big change. If something breaks, you go back in one step.
If your laptop breaks, or you switch computers
With your code on GitHub or GitLab, you copy it down and carry on. Anything you never pushed is lost.
If you want your site online
Hosts like Vercel, Netlify and Cloudflare put your site online from your repository. Each push to main can update it.

Words: Git, GitHub, GitLab, Repository, Push

What’s the fastest way to save my code online?

Make a free account and an empty private repository. Then paste the prompt below into your AI tool. You sign in yourself, and it runs the Git commands.

If you already have a product and want branches and reviews too
Open the GitHub or GitLab tool page. It walks you through a branch, a review and a merge.

In a guide

Prompt: Saving your code
I want this product saved with Git and backed up online. Ask me whether I use GitHub or GitLab, and whether I already have an account. If I don’t, tell me to make one myself and wait.
Before anything is uploaded, check that .env and any other files with keys are listed in .gitignore. Show me file names only, never key values.
Then set up Git with main as the branch name, save a first version, and help me push it to a new private repository. Let me do any sign-in myself.
Explain each step in plain words. Ask me before you install anything or do anything that costs money.

This comes from https://buildladder.com/concepts/saving-your-code#fastest-way. If you can open web pages, read https://buildladder.com/concepts/saving-your-code.md for the current version. BuildLadder guide, tool, concept, answer and setup pages all work this way: add .md to the address.

Words: AI coding tool, Push

GitHub or GitLab: which should I use?

It comes down to where the people you work with keep their code. Both work with Git the same way.

If you might switch later
You can. Your history lives in Git, so your AI tool can push it to the other one and change where origin points.
QuestionGitHubGitLab
What a proposed change is calledA pull request.A merge request.
AI review built inCopilot code review. It leaves comments, not an approval.GitLab Duo’s code review. A group owner has to turn it on first.

Swipe the table sideways to see every column.

Words: Pull request (merge request), Remote, Code review

Should I set up Git and GitHub now or later?

Now, before your AI tool makes its first big change. It takes a few minutes, and every version after that is saved. Branches and reviews can wait until your site is online.

If you work alone and nothing is online yet
Saving straight to main is fine. Push after each change that works.
If your site is online, or someone else works on it too
Start using a branch and a pull request for each change, so nothing reaches main unchecked.

Words: Branch, Main branch, Pull request (merge request)

Are GitHub and GitLab free?

Yes. Both free plans store private code with its full history. You pay for bigger teams or built-in AI review.

If you want an AI review for free
Ask your AI tool to review the branch. The step “Get the change reviewed” on the GitHub and GitLab tool pages has a prompt for it.
QuestionGitHubGitLab
Free planUnlimited public and private repositories and collaborators.10 GiB of storage. A private group can have up to five people.
First paid planTeam, $4 per person a month.Premium, $29 per person a month, billed yearly.
AI reviewNeeds Copilot Pro, $10 a month, or higher. Each review uses AI credits.Uses GitLab Credits, bought as an add-on on the free plan.

Swipe the table sideways to see every column.

What changes about saving code when more people work on it?

Each person works on their own branch and opens a pull request. Someone reviews it before it’s merged into main.

If two people change the same lines
Git can’t pick for you, so it reports a merge conflict. Your AI tool can show each clash and help you choose.
If you want every change checked before it reaches your site
Protect main, so changes only arrive through a reviewed pull request. On GitHub, protecting main in a private repository needs a paid plan.

Words: Merge conflict, Pull request (merge request)

How do commits, branches, main and origin work?

A commit is Git’s name for a saved version of your files. A branch is a name that points at the newest commit in one line of work. Main is the first branch, and origin is Git’s name for your online copy.

If you make a branch
Git starts a new line of commits from where you are. Main doesn’t move until you merge the branch into it.
If you push
Git sends your new commits to origin. Nothing goes up until you push.
If an older repository calls its first branch master
That is the same thing. Main is only a default name, and the first branch isn’t special.

Words: Commit, Branch, Main branch, Remote, Push, Merge

Questions people ask

Updated Sources: GitHub Actions: current included compute, Stack Overflow Developer Survey 2025: code and collaboration tools, GitHub Octoverse 2025, About GitLab, GitHub pricing, GitHub’s plans, GitHub Copilot plans, GitLab pricing, GitLab: free user limit, Git: working with remotes, Git: branches in a nutshell, GitHub: about branches, GitHub: using Copilot code review, GitLab: Code Review Flow, Vercel deploys from Git, Netlify: linking a repository, Cloudflare Workers Builds.