noknow.dev
Sign inSign up
Course overview
Git — Complete Course
0 / 24 lessons0%

Git Basics

  • git init — Starting a Repository
  • git add + git commit — Your First Commit
  • git status + git log — Reading the State
  • git diff — Seeing What Changed
  • .gitignore — Ignoring Files

Branching

  • git branch + git switch — Working with Branches
  • git merge — Combining Branches
  • Resolving Merge Conflicts
  • Cleaning Up Branches

Remote Repositories

  • git remote — Connecting to a Remote
  • git push — Uploading Your Commits
  • git fetch + git pull — Getting Remote Changes
  • git clone — Copying a Repository

Undoing Changes

  • git restore — Discarding Uncommitted Changes
  • git reset — Moving HEAD Back
  • git revert — Safely Undoing a Commit
  • git stash — Temporarily Saving Work

Rewriting History

  • git commit --amend — Fixing the Last Commit
  • git rebase — Cleaner History
  • git cherry-pick — Applying Specific Commits

Advanced Tools and Workflows

  • git tag — Marking Releases
  • Mastering git log
  • git bisect — Finding Bugs with Binary Search
  • Professional Git Workflows

git init — Starting a Repository

0m 00s

What Is Git?

Git is a version control system — it tracks every change you make to your files so you can go back in time, collaborate with others, and understand why code changed.

The three areas of Git

  1. Working directory — the files you're editing right now
  2. Staging area (index) — a holding zone for changes you're about to commit
  3. Repository (.git folder) — the full history of every commit ever made

Creating a repository

mkdir my-project
cd my-project
git init          # creates the .git folder
ls -la            # you'll see .git/

After git init the directory is an empty repository — no commits yet, but Git is watching.

git status        # shows the current state
# On branch master
# No commits yet
# nothing to commit

Your Task

The script below creates a new directory. Initialize a Git repository inside it, then create a file called hello.txt containing the text Hello, Git!.

First lesson
bashCtrl+Enter to run
Output

Click "Run" to execute your code.