Skip to content
Parwaz DigitalMarketing · Web · Courses

Web Development Course · Module 4, lesson 1

Version control with Git: your first repository

Understand why developers use version control, then create a Git repository, stage changes and record your first commits from the terminal.

What you will learn

  • Explain what version control is and why every project needs it
  • Initialise a repository and check its state with git status
  • Stage and commit changes with git add and git commit

Version control records the history of a project, so you can see what changed, when and why, and return to an earlier version if something breaks. Git is the standard version control system. It runs on your own computer and stores the history in a hidden .git folder inside your project. Before your first commit, set your name and email with git config.

Open a terminal in your project folder and run git init to start a repository. git status shows which files are new or changed. Git uses a staging area: git add index.html marks a file to be included in the next snapshot, and git add . stages everything in the folder. This lets you choose exactly which changes go together.

git commit -m "Add product grid" saves the staged changes as a commit, a permanent snapshot with a message. git log lists past commits, and git diff shows changes you have not yet staged. Commit whenever you finish a small, working step. If you make a mistake later, you can compare against or restore an earlier commit rather than starting again from scratch.

Practice task

Install Git, run git init in your bakery project folder and make three separate commits: one for the HTML, one for the styles and one for the JavaScript. Then view them with git log.

Web Development Course

Learn this properly,with a final project.

These pages summarise each lesson. The full course teaches them hands-on. Message us for the current fee, schedule, and format.

Available for new projects — Replies within one business day