Module 05
Module 05
15 min

Git and GitHub

Save your work and collaborate with version control

Why Version Control?

Git tracks every change you make to your code. If something breaks, you can go back to a working version. GitHub stores your code in the cloud and enables deployment.

Essential Git Commands

The commands you'll use daily:

  • git status — See what files have changed
  • git add . — Stage all changes for commit
  • git commit -m 'message' — Save changes with a description
  • git push — Upload changes to GitHub

Creating a GitHub Repository

Steps to connect your project to GitHub:

  • Create a GitHub account if you don't have one
  • Click 'New Repository' on GitHub
  • Name it the same as your project folder
  • Follow the instructions to push an existing repository

Cursor has built-in Git support. You can stage, commit, and push changes from the Source Control panel (Cmd/Ctrl + Shift + G).

Making Your First Commit

Let's save your work. In the terminal:

Commands to run:

  • git add .
  • git commit -m 'Initial commit with Next.js setup'
  • git push -u origin main

Commit often. Small, frequent commits are easier to understand and roll back than large, infrequent ones.

Module Complete!

Great work! Continue to the next module.