# 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.

Web page: https://buildladder.com/concepts/saving-your-code

## Do I need it?

**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.

## What’s the fastest way to add it?

**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.

Prompt to copy:

```text
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.
```

## Which one?

**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.

- GitHub: Pick GitHub if you want to follow most guides and examples as written, or work with people who already use it. Steps: https://buildladder.com/tools/github.md
- GitLab: Pick GitLab if your team, school or company already uses it, so your code lives where theirs does. Steps: https://buildladder.com/tools/gitlab.md

|  | GitHub | GitLab |
| --- | --- | --- |
| What a proposed change is called | A pull request. | A merge request. |
| AI review built in | Copilot code review. It leaves comments, not an approval. | GitLab Duo’s code review. A group owner has to turn it on first. |

## Now or later?

**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.

## Free or paid?

**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.

|  | GitHub | GitLab |
| --- | --- | --- |
| Free plan | Unlimited public and private repositories and collaborators. | 10 GiB of storage. A private group can have up to five people. |
| First paid plan | Team, $4 per person a month. | Premium, $29 per person a month, billed yearly. |
| AI review | Needs Copilot Pro, $10 a month, or higher. Each review uses AI credits. | Uses GitLab Credits, bought as an add-on on the free plan. |

## What changes when you grow?

**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.

## How does it work underneath?

**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.

## Sources

Updated 2026-11-10.

- [GitHub Actions: current included compute](https://docs.github.com/en/billing/concepts/product-billing/github-actions)
- [Stack Overflow Developer Survey 2025: code and collaboration tools](https://survey.stackoverflow.co/2025/technology#1-code-documentation-and-collaboration-tools)
- [GitHub Octoverse 2025](https://github.blog/news-insights/octoverse/octoverse-a-new-developer-joins-github-every-second-as-ai-leads-typescript-to-1/)
- [About GitLab](https://about.gitlab.com/company/)
- [GitHub pricing](https://github.com/pricing)
- [GitHub’s plans](https://docs.github.com/en/get-started/learning-about-github/githubs-plans)
- [GitHub Copilot plans](https://github.com/features/copilot/plans)
- [GitLab pricing](https://about.gitlab.com/pricing/)
- [GitLab: free user limit](https://docs.gitlab.com/user/free_user_limit/)
- [Git: working with remotes](https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes)
- [Git: branches in a nutshell](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell)
- [GitHub: about branches](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches)
- [GitHub: using Copilot code review](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/request-a-code-review/use-code-review)
- [GitLab: Code Review Flow](https://docs.gitlab.com/user/duo_agent_platform/flows/foundational_flows/code_review/)
- [Vercel deploys from Git](https://vercel.com/docs/git)
- [Netlify: linking a repository](https://docs.netlify.com/build/git-workflows/repo-permissions-linking/)
- [Cloudflare Workers Builds](https://developers.cloudflare.com/workers/ci-cd/builds/)
