135.2 Understanding Git and GitHub

Learn the difference between Git and GitHub, how they work together, and how you can use them to manage and share your code.

What is Git?

Git is a version control system installed on your computer. It allows you to track changes in your files, go back to earlier versions, and manage code history.

Git works locally—this means all your version history is stored on your machine. You don’t need to be connected to the internet to use Git.

Git helps you:

  • Save checkpoints in your project (commits)

  • Create branches to try new features

  • Merge changes from different branches

  • Undo mistakes by rolling back to previous commits

Git is a powerful, flexible tool used by almost every software development team in the world.

What is GitHub?

GitHub is an online platform that hosts Git repositories in the cloud. It adds collaboration, backup, and project management features to Git.

GitHub helps you:

  • Store your Git projects online (remote repositories)

  • Share your work with others or keep it private

  • Collaborate through pull requests and code reviews

  • Track issues, changes, and contributions

While Git is the engine, GitHub is the garage where all the vehicles (projects) are stored, polished, and shared.

Git is the tool. GitHub is the service that helps you use that tool with others.

Git vs GitHub: Key differences

Feature
Git
GitHub

Location

Local (on your computer)

Remote (in the cloud)

Purpose

Tracks changes to code

Hosts projects and enables collaboration

Internet required?

No

Yes (to push/pull updates)

Tool or platform?

Tool

Platform

Working with both: Local and remote

Here’s how Git and GitHub work together:

  1. You create a Git repository on your computer.

  2. You make commits as you change your code.

  3. You connect your local repository to GitHub (remote).

  4. You push your changes from your computer to GitHub.

  5. You pull updates from GitHub to get others’ changes.

This creates a two-way workflow between your machine and the cloud.

The diagram below demonstrates the Git and GitHub interface and the key commands and processes.

Cloning a project from GitHub

When you want to start working on an existing project hosted on GitHub:

  • You clone it using your IDE or the command:

    git clone https://github.com/username/project-name.git

This provides a complete copy of the repository, including all history, branches, and files.

Making changes and pushing them

The basic Git + GitHub workflow looks like this:

# Make some edits to your files...

git add .                    # Stage your changes (. = all files)
git commit -m "Add feature"  # Save a snapshot with a message
git push origin main         # Push to GitHub

This keeps your GitHub project up to date with your local changes.

Summary

  • Git is the version control tool you install and use locally.

  • GitHub is an online platform that stores your Git projects and helps you collaborate.

  • Together, they support a powerful workflow for saving, sharing, and managing code.

  • Most developers work locally with Git and sync changes to GitHub to share with others.

In the next section, we’ll look at how Git commands and IDE tools work together—and how you can choose the best way to interact with your project.

Last updated

Was this helpful?