Git & GitHub · Getting Started

Introduction to Git and GitHub

Git remembers every version of your project on your computer. GitHub keeps a copy online so you can back it up, share it and work on it with other people.

Beginner 5 min Lesson 1 of 19Shows Git 2.47 and GitHub.com as of 2026. GitHub changes its layout from time to time; button names stay the same.
0/19 in Git & GitHub
On this page · 5 min · Beginner

Learning objectives#

  • Explain the difference between Git and GitHub
  • Name the four places your changes live
  • Know what a commit, a push and a pull do
  • Understand why every developer is expected to know Git

Explanation#

Git is a version control system: a program on your computer that saves snapshots (commits) of your project. You can go back to any snapshot, see who changed what, and try ideas on separate branches without breaking the working version.

GitHub is a website that hosts Git repositories. It adds everything around the code: a web page for each project, pull requests for reviewing changes, issues for tasks, Actions for automation and Pages for free websites. GitLab and Bitbucket are similar sites; Git itself works the same with all of them.

A change travels through four places. You edit files in your working folder; git add puts the changes you want into the staging area; git commit saves them as a snapshot in your local repository; git push uploads new commits to GitHub. git pull does the opposite and brings other people’s commits down to you.

You do not need the command line for everything: VS Code, GitHub Desktop and the GitHub website can do most of it with buttons. Learning the few core commands still pays off, because every tool uses the same ideas.

Step-by-step screens#

Drawings of github.com, the Git installer, VS Code and a terminal. GitHub changes its layout from time to time; the button names stay the same. The red numbers match the numbered actions under each picture; names on your computer will differ.

Loading pictures…

Code example: The everyday cycle in five commands#

ShellThe everyday cycle in five commands Illustrative
git clone https://github.com/asha/hello-github.git   # copy a repository to your computer
cd hello-github


# ...edit index.html in VS Code...


git add index.html                  # 1. stage the change
git commit -m "Add a welcome line"  # 2. save a snapshot
git push                            # 3. upload it to GitHub
git pull                            # 4. download changes made by others
Expected output
[main 3f9c2a1] Add a welcome line
 1 file changed, 1 insertion(+)
To https://github.com/asha/hello-github.git
   8d41e07..3f9c2a1  main -> main
Already up to date.

This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.

Step-by-step explanation#

  1. git clone downloads the whole project, including its history.
  2. git add chooses which changes go into the next snapshot.
  3. git commit stores the snapshot locally with a message — nothing is online yet.
  4. git push sends your new commits to GitHub; git pull brings down everyone else’s.

Real-world use case#

A student keeps every college project on GitHub. When the laptop breaks, git clone restores everything on a new one in a minute — and recruiters can read the code and commit history.

Common mistakes#

Thinking Git and GitHub are the same thing

Git runs on your computer and works offline. GitHub is one of several websites that host Git repositories.

Committing but forgetting to push

A commit is only on your computer. Until you push, nobody else (and no backup) has it.

Best practices#

  • Commit small, related changes with a clear message
  • Push at least once a day
  • Pull before you start working
  • Keep one repository per project

Remember this#

Git = version history on your computer.

GitHub = the online home for Git repositories.

add → commit → push; pull to get others’ work.

Practice exercise#

Your task: Write the command that shows the history of commits in the current repository, one line per commit.

Show solution
Shell Illustrative
git log --oneline

Mini quiz#

Introduction to Git and GitHub quizMultiple choice Question 1 of 2

Which command uploads your commits to GitHub?

Score so far: 0/0

Want more? Practise all Git & GitHub MCQs · Git & GitHub interview questions

My notes#

Saved in this browser.

Progress is saved in this browser. Sign in to sync.