525.1 Version control and Git

Learn how version control systems like Git help developers manage, track, and collaborate on code.

Overview

In this topic, we explore how developers use version control systems to manage changes in their code. Version control allows teams to track progress, roll back mistakes, and collaborate on the same project without overwriting each other's work. Students are introduced to Git, the most widely used version control tool, and how it integrates with online platforms like GitHub.

Targets

In this topic, students learn to:

  • Explain the purpose and benefits of version control

  • Use Git to track changes in a project

  • Understand key Git commands such as add, commit, and push

  • Create and manage repositories locally and on GitHub

  • Collaborate by pulling updates and resolving conflicts

Syllabus references

Programming for the web

Designing web applications

  • Investigate the reasons for version control and apply it when developing web application

What is version control?

Version control is a system that tracks changes to code over time. It allows developers to:

  • View the history of edits

  • Restore earlier versions if needed

  • Work on features without affecting the main project

  • Merge contributions from multiple collaborators

Without version control, it’s difficult to manage files and code changes, especially in team environments.

What is Git?

Git is a distributed version control system used by developers to:

  • Record changes to files

  • Create snapshots of a project (called commits)

  • Share and combine code using branches and merges

Each developer has a full copy of the project history on their machine, making Git fast and resilient.

Git basics: a typical workflow

  1. Initialise a repository

    git init
  2. Stage changes

    git add filename
  3. Commit changes

    git commit -m "Add login form"
  4. Push to GitHub (or another remote)

    git push origin main
Git tracks changes in a local repository and syncs with a remote like GitHub, allowing individuals and teams to manage project history collaboratively.

Collaboration with GitHub

GitHub is a cloud-based platform that hosts Git repositories. It allows developers to:

  • Share projects publicly or privately

  • Use issues and pull requests to manage contributions

  • Fork and clone other repositories

  • Collaborate across locations using a shared online codebase

Students often begin by cloning a starter repository, creating branches, and submitting changes.

Summary

Version control is essential in modern software development. Git provides the tools to track, manage, and merge changes efficiently. Paired with platforms like GitHub, version control supports individual progress and team collaboration, making projects more organised, recoverable, and scalable.

Last updated

Was this helpful?