Mainframe Path Start learning free
Beginner6 min readLesson 1 of 4

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.

Git and GitHub are not the same thing
Git: the tool
Runs on your machine (and on z/OS)Records commits, branches and mergesWorks with no server at allFree, open source, command line
GitHub: a hosting service
A website that stores Git repositoriesAdds pull requests and code reviewAdds issues, permissions and GitHub ActionsOwned by Microsoft. GitLab and Bitbucket are similar services

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.

TRY IT YOURSELF

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

Thinking Git and GitHub are the same

Git works perfectly well with no GitHub at all. GitHub is one of several places to host and share repositories.

Keeping copies instead of history

Copies like file_v2_final hide what changed. Commit instead, with a message saying why.

Committing secrets

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

Key terms

Check your understanding.
Take this lesson's quiz and save your progress. Free.

Take the lesson quiz
Clone, stage, commit, push and pull →