Learn Programming, Tech & Coding · Free Online Tools

IT Question Answer
Back to What Is
What is Git and How Does it Work?

What is Git and How Does it Work?

What Is2,222 viewsBy Admin
git

What is Git?

Git is the world's most popular version control system. It tracks every change to your code, lets multiple people collaborate, and lets you revert mistakes. Created by Linus Torvalds in 2005.

Core Commands

git init                 # start tracking a project
git add .                # stage changes
git commit -m "message"  # save a snapshot
git status               # see what changed
git log                  # view history

How Git Works

Git stores snapshots of your project. Each commit is a checkpoint you can return to. Changes move through three areas:

AreaCommand
Working directoryyour files
Staging areagit add
Repositorygit commit

Branching

git branch feature       # create branch
git checkout feature     # switch to it
git merge feature        # merge into current branch

FAQs

Git vs GitHub?

Git is the tool; GitHub is a hosting service for Git repositories. More in our Git guides.

Do I need GitHub to use Git?

No — Git works locally. GitHub adds online collaboration.