Mastering VS Code: Debugging & Workflow

Mastering VS Code: Debugging & Workflow
image
The Complete GitHub Guide — From Zero to Pro
2026 Edition • Complete Guide

The Complete Guide to
GitHub

Learn how to create repositories, push code, manage branches, collaborate with teams, and master the Git workflow — from absolute zero to confident contributor.

Start Reading ↓
01

What Is GitHub & Why Should You Care?

Git is a distributed version control system that tracks every change you make to your code. Think of it as an “unlimited undo” button for your entire project — you can jump back to any point in time, see who changed what, and safely experiment without breaking things.

GitHub is a cloud platform built on top of Git. It hosts your repositories (projects) online, adds collaboration tools like pull requests, issues, and actions, and serves as the world’s largest developer community. Whether you’re building a personal project or contributing to open source, GitHub is where modern software lives.

💡 Key Distinction
Git is the tool that runs on your machine. GitHub is the platform that hosts your Git repositories in the cloud. You use Git commands locally and push your work to GitHub to share it.
02

Setting Up Git & GitHub

Step A — Install Git

Download Git from git-scm.com. On macOS you can also use Homebrew; on most Linux distros, Git comes pre-installed.

Terminal
# Check if Git is installed
git --version

# macOS with Homebrew
brew install git

# Ubuntu / Debian
sudo apt install git

Step B — Create a GitHub Account

Head to github.com and sign up for a free account. Choose a username you’ll be proud of — it becomes part of your public developer identity.

Step C — Configure Git Locally

Tell Git who you are. This information gets attached to every commit you make.

Terminal
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

# Verify your settings
git config --list

Step D — Set Up SSH Authentication (Recommended)

SSH keys let you push and pull code without typing your password every time.

Terminal
# Generate a new SSH key
ssh-keygen -t ed25519 -C "you@example.com"

# Copy the public key to your clipboard
cat ~/.ssh/id_ed25519.pub

# Then paste it into GitHub → Settings → SSH Keys
03

Creating Your First Repository

A repository (or “repo”) is a project folder that Git tracks. You can create one on GitHub’s website, from the command line, or both.

Option 1 — Create on GitHub, Clone Locally

1
Click “New Repository” on GitHub (the green button or the + icon in the top nav).
2
Fill in details: name, description, public/private, optionally add a README and .gitignore.
3
Clone it to your machine with the command below.
Terminal
git clone git@github.com:your-username/my-project.git
cd my-project

Option 2 — Start Locally, Push to GitHub

Terminal
# Create a folder and initialize Git
mkdir my-project && cd my-project
git init

# Create a file and make your first commit
echo "# My Project" > README.md
git add README.md
git commit -m "Initial commit"

# Link to GitHub and push
git remote add origin git@github.com:your-username/my-project.git
git push -u origin main
04

The Core Git Workflow

Day-to-day Git boils down to a simple loop. Understanding this cycle is the single most important thing to internalize.

Edit Files
Stage Changes
Commit
Push
Terminal — The Daily Workflow
# 1. Check what's changed
git status

# 2. Stage specific files (or all changes)
git add index.html style.css
git add .          # stage everything

# 3. Commit with a descriptive message
git commit -m "Add responsive nav bar"

# 4. Push to GitHub
git push
⚠ Common Mistake
Don’t use vague commit messages like “fixed stuff” or “update”. Your future self (and your team) will thank you for clear, specific messages: Fix login timeout on mobile Safari.
05

Branching & Merging

Branches let you work on features, fixes, or experiments in isolation without touching the stable main branch. This is what makes team collaboration possible — everyone works on their own branch, then merges when ready.

Terminal — Branch Operations
# Create and switch to a new branch
git checkout -b feature/user-auth

# See all branches (* = current)
git branch

# Switch between branches
git checkout main

# Merge a branch into main
git checkout main
git merge feature/user-auth

# Delete a branch after merging
git branch -d feature/user-auth
💡 Branch Naming Convention
Use prefixes to keep things organized: feature/ for new features, fix/ for bug fixes, hotfix/ for urgent production fixes, and chore/ for maintenance tasks.
06

Pull Requests & Collaboration

A Pull Request (PR) is GitHub’s way of saying “Hey team, I’ve got changes ready — please review and merge them.” It’s the heart of collaboration on GitHub.

Creating a Pull Request

1
Push your branch to GitHub with git push -u origin feature/user-auth
2
Open a PR on GitHub — click “Compare & pull request” on the yellow banner, or go to the Pull Requests tab.
3
Write a description explaining what changed and why. Link any related issues.
4
Request reviewers. Your teammates review the code, leave comments, and approve or request changes.
5
Merge! Once approved, click “Merge pull request” and delete the branch.

Contributing to Other Projects (Fork & PR)

Want to contribute to someone else’s open-source repo? The workflow is: Fork → Clone → Branch → Change → Push → PR.

Terminal — Fork Workflow
# 1. Fork the repo on GitHub (click "Fork" button)
# 2. Clone YOUR fork
git clone git@github.com:your-username/forked-repo.git

# 3. Add original repo as "upstream"
git remote add upstream git@github.com:original-owner/repo.git

# 4. Create a branch, make changes, push to YOUR fork
git checkout -b fix/typo-in-readme
# ... make changes ...
git push origin fix/typo-in-readme

# 5. Open a PR from your fork to the original repo
07

Updating & Syncing Changes

When other people push changes, you need to pull them down. When your branch falls behind main, you need to rebase or merge. Here are the essential commands.

Terminal — Staying in Sync
# Pull the latest changes from the remote
git pull

# Pull with rebase (cleaner history)
git pull --rebase

# Update your feature branch with latest main
git checkout feature/my-work
git rebase main

# If you're working on a fork, sync with upstream
git fetch upstream
git rebase upstream/main

Handling Merge Conflicts

Conflicts happen when two people edit the same line. Git will mark the conflicts in your files with <<<<<<< markers. To resolve them:

  1. Open the conflicted file and find the conflict markers.
  2. Choose which version to keep (or combine both), and delete the markers.
  3. Stage the resolved file with git add and continue.
Terminal — Resolving Conflicts
# After fixing the conflict in your editor:
git add conflicted-file.js
git rebase --continue
# or if merging:
git commit
08

Essential GitHub Features

Issues

GitHub Issues are your project’s task tracker. Use them to report bugs, request features, or track to-dos. You can label them, assign team members, and link them to PRs with keywords like Fixes #42 in your commit message.

GitHub Actions (CI/CD)

Automate testing, building, and deploying your code. Actions run workflows triggered by events like pushes or PRs. A workflow is defined in a YAML file inside .github/workflows/.

GitHub Pages

Host static websites directly from a repo — perfect for portfolios, documentation, and project landing pages. Enable it in your repo’s settings under “Pages.”

The .gitignore File

This file tells Git which files and folders to ignore — things like node_modules/, environment files (.env), and build artifacts. GitHub provides templates for every major language at github/gitignore.

README.md

Your repo’s front page. A great README includes a project description, installation instructions, usage examples, and contribution guidelines. It’s the first thing visitors see — make it count.

09

Best Practices & Pro Tips

Commit often, push regularly. Small, frequent commits are easier to review, revert, and understand than massive dumps of changes.
Write meaningful commit messages. Follow the convention: imperative mood, present tense. “Add search feature” not “Added search feature.”
Never commit secrets. API keys, passwords, and tokens should live in .env files which are listed in your .gitignore.
Use branches religiously. The main branch should always be stable. All work happens in feature branches.
Review before merging. Even on solo projects, review your own diffs before merging. You’ll catch mistakes and write better code.
Keep your repos clean. A good .gitignore, clear folder structure, and an up-to-date README make all the difference.
10

Quick Command Reference

Git Cheat Sheet
# ── Setup ──
git init                          # Initialize new repo
git clone <url>                   # Clone existing repo

# ── Daily Work ──
git status                        # See changes
git add .                         # Stage all changes
git commit -m "message"          # Commit staged changes
git push                          # Upload to GitHub
git pull                          # Download latest changes

# ── Branching ──
git branch                        # List branches
git checkout -b branch-name      # Create & switch branch
git merge branch-name             # Merge branch into current
git branch -d branch-name        # Delete branch

# ── History & Inspection ──
git log --oneline                 # Compact commit history
git diff                          # See unstaged changes
git stash                         # Temporarily shelve changes
git stash pop                     # Restore shelved changes

# ── Undo ──
git checkout -- file.txt         # Discard file changes
git reset HEAD~1                  # Undo last commit (keep files)
git revert <commit-hash>          # Create undo commit

Now go build something amazing. Your first git push is waiting. 🚀

git github version-control beginner-guide developer-tools open-source

Written with ♥ for developers everywhere

🤞 Sign up for our newsletter!

We don’t spam! Read more in our privacy policy

Comments are closed.

Scroll to Top