Skip to content
Laviyx Learn

Try

Git and GitHub course menu

What Is Git? Version Control Explained for Beginners

What Git and version control are, why every developer uses them, the difference between Git and GitHub, what a repository and a commit are, and how this course works.

Beginner3 min readUpdated
On this page

Git is a version control system: a tool that records every change you make to a project, so you can see what changed, go back to any earlier version, and work with other people on the same files without overwriting each other's work.

Nearly every software team uses it. Knowing Git is expected for almost any developer, data or DevOps job, and your GitHub profile often counts as part of your portfolio.

The problem Git solves#

Without version control, projects tend to look like this:

Text
report.docx
report_final.docx
report_final_v2.docx
report_final_v2_REALLY_FINAL.docx

You cannot tell what changed between the files, and if two people edit a copy at the same time, someone has to combine them by hand.

With Git there is one folder of files, plus a complete history of every saved version, who made it, when, and why. Going back is one command.

Key words#

WordMeaning
Repository (repo)A project folder tracked by Git. The history lives in a hidden .git folder inside it.
CommitOne saved snapshot of the project, with a message describing the change.
BranchA separate line of work, so a new feature can grow without touching the main code.
MergeCombining the work from one branch into another.
RemoteA copy of the repository on another computer, usually on GitHub.

History in Git is a chain of commits, each pointing back to the one before it. The newest commit on the current branch is called HEAD:

Text
A <--- B <--- C <--- D   main (HEAD)

Git is not GitHub#

These two are often confused:

GitGitHub
A program on your computerA website that hosts Git repositories
Works completely offlineNeeds the internet
Created by Linus Torvalds in 2005 for Linux kernel developmentA company, now owned by Microsoft
Records your historyAdds sharing, pull requests, issues and automation

You can use Git without GitHub. GitLab and Bitbucket are alternatives to GitHub, and all of them store ordinary Git repositories.

Why Git is called distributed#

In older systems, the history lived on one central server. In Git, every copy of a repository contains the full history. You can commit, browse old versions and create branches with no network connection, and if a server is lost, any clone can restore the project.

How this course works#

You will type commands in a terminal, mostly in a small practice project. Every Git command that shows output in this course was run while writing it, and the output below it is the real result. Steps that happen on the GitHub website are described instead. Commit IDs such as a3f1c2d are calculated from a commit's content, author and time, so the IDs on your computer will be different from ours. Everything else should match.

Key takeaway#

Next: Installing and Configuring Git.

Finished this lesson?