What version control does, and Git versus GitHub
Version control keeps the full history of a project: every change, who made it, when and why, so you can compare versions, undo mistakes and work in parallel. Git is the version control tool. GitHub is a website that hosts Git repositories and adds pull requests, reviews and automation around them.
The problem it solves
Without version control, teams end up with files called payroll_v2_final_REALLY_final.cbl, copies of copies in personal libraries, and no reliable answer to 'what changed since last week?' Version control records every change as a step in a history. You can see who changed what and why, compare any two versions, go back to an older one, and let several people work on the same code without overwriting each other.
Git in one paragraph
Git is the version control tool almost everyone uses today. It is free and open source, and it was created in 2005 by Linus Torvalds for Linux kernel development. Git is distributed: every developer's copy of a repository holds the full history, so you can commit, compare and branch on your own machine without a network connection, and share your work later.
What a repository holds
A repository is a project folder plus a hidden .git folder that holds the entire history. Each saved change is a commit: a snapshot of the tracked files, with an author, a date, a message, and a unique ID (a long hexadecimal hash, usually shown shortened to seven characters, such as 3f9c2a1). Commits link to the commit before them, so together they form the project's history.
Which one is the version control tool that runs on your own machine: Git or GitHub?
Show a hint
The other one is a website.
Show the solution
Git. GitHub is a hosting service built around Git.
Common mistakes
Git works perfectly well with no GitHub at all. GitHub is one of several places to host and share repositories.
Copies like file_v2_final hide what changed. Commit instead, with a message saying why.
Passwords, keys and tokens stay in the history even after you delete them in a later commit. Keep them out of repositories.
What you will see at work
- Job descriptions say 'Git' and mean the daily habits: clone, commit, branch, pull request. Those are what this course covers.
- A commit ID is how teams point at an exact version: 'the build from 3f9c2a1 failed'.
- Your company may use GitHub, GitLab, Bitbucket or Azure Repos. The Git commands are identical; only the website differs.
Key terms
Check your understanding.
Take this lesson's quiz and save your progress. Free.