Beginner-Friendly

Master GitHub
from scratch

GitHub is the world's leading platform for code collaboration. Whether you're a developer, writer, or total beginner — this guide walks you through everything step by step.

Terminal
$ git init my-project
✓ Initialized empty Git repository
$ git add .
$ git commit -m "Initial commit"
✓ [main] 3 files changed
$ git push origin main
Enumerating objects: 5, done.
Writing objects: 100% (5/5)
✓ Branch 'main' → 'origin/main'
$

A home for your code — and your team

GitHub is a web platform built on Git, the open-source version control system. Think of it as Google Docs, but for code.

  • 🗂️
    Version Control

    Every change is tracked. Roll back to any previous version of your project at any time.

  • 🤝
    Collaboration

    Multiple people can work on the same project simultaneously without overwriting each other.

  • 💬
    Code Review

    Teammates can comment on, suggest, and approve changes before they're merged.

  • 🌐
    Open Source Hub

    Over 100 million developers share and contribute to public projects worldwide.

  • ⚙️
    Automation

    GitHub Actions lets you automatically test, build, and deploy your code on every push.

🕐 A brief history

GitHub was created by Chris Wanstrath, P.J. Hyett, Tom Preston-Werner, and Scott Chacon using Ruby on Rails. It launched in February 2008 and was acquired by Microsoft in 2018 for $7.5 billion.

CW
Chris W.
PJ
P.J. Hyett
TP
Tom P.
SC
Scott C.

🆚 Git vs. GitHub

Git is the version control software that runs on your computer. GitHub is a cloud platform that hosts your Git repositories online, making them shareable and collaborative.

👥 Not just for developers

Writers, designers, scientists, and students all use GitHub to manage documents, research, design files, and collaborative projects.

Why millions of teams rely on it

From solo projects to large enterprise teams, GitHub solves real problems that every collaborator faces.

🔍

Never lose your work

Every version of your project is saved in the cloud. Accidentally deleted something? GitHub has it. Hard drive crashed? GitHub has it.

Work without conflicts

Teams can work on different features simultaneously using branches. Changes are merged when ready, eliminating duplicate work.

📋

Built-in project management

Issues, milestones, and project boards let you track bugs, plan features, and organize work — all in one place.

🚀

Automated workflows

GitHub Actions automatically tests your code on every commit. Ship with confidence knowing nothing is broken.

🌍

Global community

Access millions of open-source projects. Learn from real codebases, report bugs, and contribute back to the community.

🛡️

Security built in

Automated vulnerability scanning, secret detection, and code review workflows keep your project secure by default.

Create your GitHub account

It only takes a few minutes. Follow these steps to get up and running.

1

Go to github.com and click "Sign Up"

Open your browser and navigate to github.com. You'll see a big green "Sign Up" button on the homepage. Click it.

Enter your email address
your@email.com
Create a password
••••••••••
Enter a username
cooldev2024
Create account
2

Verify your email address

GitHub will send a verification email. Open it and click the confirmation link. Check your spam folder if you don't see it within a minute.

💡 Use a real email address — you'll need it to reset your password and receive notifications.
3

Complete the setup wizard

GitHub will ask a few questions about your role (student, developer, etc.) and what you plan to use it for. Answer honestly — it helps personalize your experience.

4

Create your first repository

A repository (or "repo") is like a folder for your project. Click the green "New" button on your dashboard, give it a name, optionally add a README file, and click "Create repository".

Create a new repository
Repository name *
my-first-project
⬤ Public
○ Private
Add a README file
Create repository
5

Install Git on your computer (optional but recommended)

To work with GitHub locally, download Git from git-scm.com. You can also use GitHub Desktop for a visual interface, or work entirely in the browser for simple edits.

The vocabulary you need to know

These are the fundamental ideas behind GitHub. Learn these and everything else will click.

Repository

Your project's home

A repository is a folder that contains all your project files, their history, and metadata. Every project lives in its own repo.

# Create a new repo locally
git init my-project
# or clone an existing one
git clone github.com/user/repo
Commit

A saved snapshot

A commit is a snapshot of your project at a specific moment. Each commit has a message explaining what changed and why.

# Stage your changes
git add .
# Save a snapshot
git commit -m "Fix login bug"
Branch

A parallel timeline

A branch is an isolated copy of your project where you can experiment or build features without affecting the main codebase.

# Create + switch to a branch
git checkout -b new-feature
# Merge it back when done
git merge new-feature
Pull Request

A request to merge

A Pull Request (PR) is how you propose changes to a repo. Teammates can review, comment, and approve before the code is merged.

# Push your branch first
git push origin new-feature
# Then open a PR on GitHub.com
→ New pull request → Review → Merge
Fork

Your own copy of any repo

Forking creates your personal copy of someone else's repository. You can experiment freely, then propose changes back via a Pull Request.

# After forking on GitHub.com:
git clone github.com/you/forked-repo
# Make changes, push, open PR
→ upstream repo ← your fork
Push & Pull

Syncing with the cloud

Push uploads your local commits to GitHub. Pull downloads the latest changes from GitHub to your machine.

# Upload your commits
git push origin main
# Download latest changes
git pull origin main

The standard GitHub workflow

Most teams follow this cycle. Once you've done it a few times, it becomes second nature.

🍴

Fork or Clone

Get the project onto your machine

🌿

Branch

Create a branch for your feature

✏️

Code

Make your changes locally

💾

Commit

Save snapshots as you go

⬆️

Push

Upload your branch to GitHub

🔀

Pull Request

Request a review and merge

📋 A typical day using GitHub

You start by pulling the latest changes with git pull to make sure you're up to date. Then you create a branch for the feature you're working on. You write code, committing often with descriptive messages. When done, you push your branch and open a Pull Request. A teammate reviews it, leaves comments, and you make tweaks. Once approved, it gets merged — and you start the cycle again.

Habits of great GitHub users

Small habits that make a huge difference in your day-to-day workflow.

✍️

Write meaningful commit messages

Use the format: "Add user login feature" or "Fix broken navbar on mobile". Future-you will thank present-you.

Commit early and often

Don't wait until a feature is finished. Commit small, working chunks. It's easier to track down bugs and easier to roll back.

🌿

Always work on a branch

Never commit directly to main. Branches are free and keep your history clean.

📝

Write a README

Every project should have a README.md explaining what it does, how to install it, and how to use it. It's the first thing visitors see.

🔒

Never commit secrets

API keys, passwords, and tokens must never go into a repo. Use .env files and add them to .gitignore.

👀

Pull before you push

Always run git pull before pushing to avoid merge conflicts with your teammates' work.

Git command cheatsheet

Bookmark this page. These are the commands you'll use every single day.

🚀 Setup & Init
git initInitialize a new local repository
git clone [url]Clone a remote repository locally
git config --global user.nameSet your global username
git config --global user.emailSet your global email
💾 Staging & Commits
git statusShow the state of your working directory
git add .Stage all changes for commit
git add [file]Stage a specific file
git commit -m "msg"Commit with a message
git log --onelineView compact commit history
🌿 Branches
git branchList all local branches
git branch [name]Create a new branch
git checkout [name]Switch to a branch
git checkout -b [name]Create and switch in one step
git merge [branch]Merge a branch into current
git branch -d [name]Delete a branch
☁️ Remote & Sync
git remote -vList remote connections
git fetchDownload changes without merging
git pull origin mainPull latest changes from main
git push origin [branch]Push a branch to GitHub
git push -u origin mainPush and set upstream tracking
↩️ Undo & Fix
git restore [file]Discard changes in working directory
git reset HEAD [file]Unstage a file
git revert [commit]Undo a commit by creating a new one
git stashTemporarily shelve your changes
git stash popRestore stashed changes
🔍 Inspect & Compare
git diffShow unstaged changes
git diff --stagedShow staged changes
git log --graphVisual branch history
git show [commit]Show details of a commit
git blame [file]Show who changed each line