Git & GitHub Interview Question #3

What is the difference between Git and GitHub?

Git Fundamentals, Repository, Working Tree, Staging, Commits & Branch Basics Junior Beginner

Quick Interview Answer

Git is the version control system that records project history and runs on a developer's computer. GitHub is an online hosting and collaboration platform for Git repositories.

Detailed Explanation

Git is the version control system that records project history and runs on a developer's computer. GitHub is an online hosting and collaboration platform for Git repositories.

You can use Git without GitHub. You can also connect the same Git workflow to other hosting providers. A common interview answer is: Git manages versions; GitHub hosts Git repositories and provides collaboration features.

Code Example

# Git works locally
git init
git add .
git commit -m "Initial commit"

# GitHub can be configured as a remote
git remote add origin https://github.com/username/project.git