0 of 0 complete
🐋

Getting Started with GitHub

Think of GitHub as Google Drive for code -- but way more powerful. It tracks every change, lets teams collaborate, and hosts millions of open-source projects.

📚 3 sections
~30 min read
🎓 Beginner friendly
Getting Started Beginner Repos Cheatsheet
Section 1

Getting Started with GitHub

Everything you need to go from zero to pushing your first code. No prior experience required.

What is GitHub?

GitHub is a platform where developers store, share, and collaborate on code. Think of it like Google Drive for code, but way more powerful. It uses a tool called git under the hood that tracks every single change you make, so you can always go back in time.

  • Repository (repo) -- a project folder tracked by git
  • Commit -- a saved snapshot of your changes
  • Branch -- a parallel version of your code
  • Pull Request (PR) -- a request to merge your changes into someone else's code
  • Fork -- your own copy of someone else's repo
Without version control, collaboration is chaos -- people overwrite each other's work, you can't undo mistakes, and there's no history of what changed or why. Git and GitHub solve all of that. Every tech company uses git. Learning it early is one of the highest-leverage things you can do.
Creating a Repository

You can create a repo from the GitHub website or the command line.

Option A: On GitHub.com

  1. Go to github.com/new
  2. Enter a repository name (e.g., my-first-repo)
  3. Add a description (optional)
  4. Choose Public or Private
  5. Check "Add a README file"
  6. Click Create repository

Option B: From the Terminal (using GitHub CLI)

terminal
$ gh repo create my-first-repo --public --clone
Expected Output
Created repository yourname/my-first-repo on GitHub Cloned fork
💡 Install the GitHub CLI first: brew install gh then gh auth login
Cloning a Repository

Cloning downloads a repo from GitHub to your computer so you can work on it locally.

terminal
$ git clone https://github.com/username/repo-name.git
$ cd repo-name
Expected Output
Cloning into 'repo-name'... remote: Enumerating objects: 42, done. remote: Counting objects: 100% (42/42), done. remote: Compressing objects: 100% (30/30), done. Receiving objects: 100% (42/42), done.
HTTPS is the easiest to start with -- you authenticate with your GitHub username and a personal access token. SSH uses cryptographic keys and is preferred for regular use because you don't have to enter credentials each time. Set up SSH with: ssh-keygen -t ed25519 then add the public key to your GitHub settings.
Making Changes: Add, Commit, Push

The core workflow you'll use every day. Edit files, stage them, commit, then push to GitHub.

the daily workflow
$ git status
$ git add .
$ git commit -m "add homepage layout"
$ git push
Expected Output (after push)
Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Writing objects: 100% (3/3), 312 bytes | 312.00 KiB/s, done. To https://github.com/username/repo-name.git a1b2c3d..e4f5g6h main -> main
git status -- shows which files have been modified, added, or deleted.
git add . -- stages all changed files (the . means "everything"). You can also add specific files: git add index.html.
git commit -m "message" -- saves a snapshot with a description of what you changed.
git push -- uploads your commits to GitHub so others can see them.
Pull Requests Explained

A Pull Request (PR) is how you propose changes to a project. Instead of pushing directly to the main branch, you create a branch, make changes, and then ask the team to review and merge them.

creating a PR workflow
$ git checkout -b feature/add-navbar
# make your changes...
$ git add .
$ git commit -m "add responsive navbar"
$ git push -u origin feature/add-navbar
Expected Output
Total 3 (delta 1), reused 0 (delta 0) remote: remote: Create a pull request for 'feature/add-navbar' on GitHub by visiting: remote: https://github.com/username/repo/pull/new/feature/add-navbar remote: * [new branch] feature/add-navbar -> feature/add-navbar Branch 'feature/add-navbar' set up to track 'origin/feature/add-navbar'.

Then open the link in your browser, write a description, and click Create Pull Request. Your teammates can review, comment, and approve before merging.

Forking Explained

Forking creates your own copy of someone else's repository. This is how you contribute to open-source projects you don't own.

  1. Click the Fork button on any GitHub repo page
  2. Clone your fork to your computer
  3. Make changes and push to your fork
  4. Open a Pull Request from your fork to the original repo
fork workflow
$ gh repo fork owner/repo --clone
$ cd repo
$ git checkout -b my-fix
# make changes...
$ git add . && git commit -m "fix typo in README"
$ git push -u origin my-fix
📝 Fork vs Clone: Cloning downloads a repo. Forking creates your own remote copy on GitHub that you can freely push to, then send PRs back to the original.
Issues and Discussions

Issues are GitHub's built-in bug tracker and feature request system. Every repo has an Issues tab where anyone can report problems or suggest improvements.

  • Use labels to categorize: bug, enhancement, good first issue
  • Reference issues in commits: git commit -m "fix login bug, closes #12"
  • Assign issues to yourself or teammates
github cli - issues
$ gh issue create --title "Fix dark mode toggle" --body "The toggle doesn't persist"
$ gh issue list
$ gh issue view 12

Discussions are for open-ended conversations -- Q&A, ideas, announcements. Enable them in your repo settings under Features.

GitHub Pages Basics

GitHub Pages lets you host a website directly from a repository -- for free. Perfect for portfolios, documentation, or project demos.

  1. Go to your repo's SettingsPages
  2. Under Source, select main branch and / (root) folder
  3. Click Save
  4. Your site will be live at https://username.github.io/repo-name
quick github pages setup
$ echo '<h1>Hello World</h1>' > index.html
$ git add index.html
$ git commit -m "add homepage"
$ git push
🚀 For a personal site, name your repo username.github.io -- it will be accessible at https://username.github.io directly.
GitHub Pages serves static files only -- HTML, CSS, JavaScript, images. It cannot run server-side code (Node.js, Python, PHP). For static site generators, it supports Jekyll natively. You can also use GitHub Actions to build and deploy sites made with React, Vue, Hugo, etc.
Section 2

Most Useful Beginner Projects & Repos

Twelve repositories every developer should know about. These are goldmines of free learning resources, project ideas, and community.

freeCodeCamp ⭐ 400k+
Free, self-paced coding curriculum covering HTML, CSS, JavaScript, Python, and more. Earn certifications along the way.
curriculum
TheOdinProject ⭐ 10k+
Full-stack web development curriculum. Covers foundations, Ruby, Rails, JavaScript, React, and Node.js with real projects.
full-stack
awesome ⭐ 330k+
The original curated list of awesome lists. Find curated resources on any topic: languages, frameworks, tools, books, and more.
curated lists
developer-roadmap ⭐ 300k+
Interactive visual roadmaps for frontend, backend, DevOps, and more. Know exactly what to learn and in what order.
learning paths
build-your-own-x ⭐ 310k+
Master programming by building things from scratch. Tutorials for building your own Git, Docker, database, game engine, and more.
build from scratch
Curated list of project-based tutorials organized by programming language. Learn by building real applications.
project tutorials
Complete computer science study plan to prepare for coding interviews at top tech companies. Data structures, algorithms, and system design.
CS study plan
public-apis ⭐ 320k+
Collective list of free APIs for use in software and web development. Weather, jokes, finance, games -- hundreds of categories.
free APIs
realworld ⭐ 80k+
The "mother of all demo apps." A Medium.com clone built with every frontend and backend framework -- compare them side by side.
full-stack demo
javascript30 ⭐ 27k+
30 Day Vanilla JS Challenge. Build 30 things in 30 days with 30 tutorials. No frameworks, no compilers, no libraries.
vanilla JS
A challenge and tracker for coding every day for 100 days. Fork the repo, log your progress, and join a community of learners.
challenge
Practice making your first open-source contribution. A step-by-step guide that walks you through forking, cloning, and creating a PR.
first PR
Star count ranges are approximate and grow over time. Star repos you find useful -- it bookmarks them to your GitHub profile for later.
Section 3

Git & GitHub Cheatsheet

Every command you need, organized by category. Click any command to copy it.

Setup & Config
git config --global user.name "Name" Set your name for all repos
git config --global user.email "email" Set your email for all repos
git config --list Show all configuration settings
git init Initialize a new git repo in current folder
git clone <url> Download a repo from GitHub to your machine
📦 Staging & Status
git status Show modified, staged, and untracked files
git add <file> Stage a specific file for commit
git add . Stage all changed files
git diff Show unstaged changes
git diff --staged Show staged changes (ready to commit)
git reset <file> Unstage a file (keep changes)
💾 Commits
git commit -m "message" Commit staged changes with a message
git commit --amend Modify the most recent commit
git log --oneline Show compact commit history
git log --graph --oneline Show commit history as a visual graph
git show <commit> Show details and diff of a specific commit
git blame <file> Show who last modified each line of a file
🌴 Branching
git branch List all local branches
git branch <name> Create a new branch
git checkout <branch> Switch to an existing branch
git switch <branch> Switch branches (newer, preferred syntax)
git checkout -b <name> Create and switch to a new branch
git merge <branch> Merge a branch into the current branch
git rebase <branch> Replay commits on top of another branch
git branch -d <name> Delete a branch (safe -- only if merged)
🌐 Remote
git remote -v Show remote URLs
git remote add origin <url> Connect your repo to a GitHub remote
git fetch Download remote changes (don't merge)
git pull Fetch + merge remote changes into current branch
git push Upload local commits to the remote
git push -u origin <branch> Push and set upstream tracking for a new branch
Undo & Fix
git restore <file> Discard uncommitted changes to a file
git restore --staged <file> Unstage a file (keep changes in working dir)
git revert <commit> Create a new commit that undoes a previous commit
git reset --soft HEAD~1 Undo last commit, keep changes staged
git reset --hard HEAD~1 Undo last commit and discard all changes (caution!)
git stash Save uncommitted changes to a temporary stack
git stash pop Restore the most recently stashed changes
git stash list List all stashed change sets
💻 GitHub CLI (gh)
gh auth login Authenticate with your GitHub account
gh repo create <name> --public Create a new public repo
gh repo clone <owner/repo> Clone a repo
gh repo fork <owner/repo> Fork a repo
gh pr create --title "title" Create a pull request from current branch
gh pr list List open pull requests
gh pr checkout <number> Check out a PR branch locally
gh pr merge <number> Merge a pull request
gh issue create --title "title" Create a new issue
gh issue list List open issues
gh repo view --web Open the current repo in your browser
gh run list List recent GitHub Actions workflow runs
🛠 Install the GitHub CLI with brew install gh (macOS) or check cli.github.com for other platforms. It makes working with GitHub from the terminal dramatically faster.