Git Tutorial
Master version control with Git. Learn essential workflows for collaborative development and manage your code with confidence.
Learn Git from scratch: staging, commits, branching, merging, remotes and rebase, then reflog, bisect, GitHub pull requests and Actions.
New to Git? Every developer needs this.
Start with Lesson 1 — Introduction to Version Control. Git is essential for any coding career, and this course makes it easy.
Continue where you left off
Lessons in this course
- Introduction to Version Control — Why version control exists and how Git tracks changes in your project
- Git Basics: Clone, Add, Commit — The three core Git commands every developer uses every single day
- Branching and Merging — Create isolated branches to work on features, then merge them back safely
- Working with Remote Repositories — Push and pull code to GitHub, GitLab, or Bitbucket with git push/pull
- Resolving Merge Conflicts — Understand why conflicts happen and how to resolve them confidently
- Git Workflows and Best Practices — Feature branch workflow, GitFlow, and commit message conventions
- The Staging Area & git diff — Stage changes precisely with git add -p and inspect them with git diff
- Undoing Changes: restore, reset & revert — Safely undo mistakes — restore files, reset commits, or revert in public history
- Stashing Work in Progress — Shelve unfinished changes with git stash and bring them back later
- Ignoring Files with .gitignore — Keep build artifacts and secrets out of Git with patterns and globs
- Exploring History with git log — Read project history with log, --oneline --graph, filtering, and git show
- Amending & Fixing Commits — Fix the last commit's message or contents with git commit --amend
- Tagging Releases — Mark versions with lightweight and annotated tags, and semantic versioning
- Rebasing Branches — Replay commits for a linear history — and the golden rule of rebasing
- Interactive Rebase: squash, edit, reorder — Clean up history with git rebase -i — squash, fixup, reword, and edit
- Cherry-Picking Commits — Apply a specific commit from one branch onto another with git cherry-pick
- Recovering Lost Work with reflog — Rescue lost commits and branches after a bad reset using git reflog
- Finding Who Changed What with git blame — Trace each line to its commit with git blame and the pickaxe (log -S)
- Hunting Bugs with git bisect — Binary-search your history to find the commit that introduced a bug
- Git Configuration & Aliases — Set up your identity, editor, and time-saving aliases with git config
- GitHub Pull Requests & Code Review — Open, review, and merge pull requests — the heart of team collaboration
- Forking & Contributing to Open Source — Fork a project, keep it in sync with upstream, and contribute via PRs
- Intro to GitHub Actions (CI/CD) — Automate tests and deploys on every push with GitHub Actions workflows
- Submodules & Monorepos — Embed one repo inside another with submodules — and when to avoid them
- Git Hooks & Automation — Run checks automatically with pre-commit and commit-msg hooks (and husky)
- Multiple Working Trees with git worktree — Check out several branches at once in separate directories that share one .git
- Git LFS & Large Files — Track binaries and large assets with pointer files and an LFS server
- How Git Works Internally — Blobs, trees, commits and the DAG — what a SHA really points to
Frequently asked questions
What is Git and why do I need it?
Git is a version-control system that tracks changes to your code, lets you undo mistakes, and makes it possible to collaborate with others without overwriting each other's work. It is an essential tool for every developer.
What is the difference between Git and GitHub?
Git is the version-control tool that runs on your computer; GitHub is a website that hosts Git repositories online for sharing and collaboration. You use Git locally and push your work to GitHub.
Is Git hard to learn?
The everyday commands — add, commit, push, pull, branch and merge — are quick to learn and cover most of what you'll do. This course teaches them with practical, real-world workflows.
More for this course
- Git cheat sheet — Quick syntax reference you can scan while you code
- Essential Git Commands for Developers — Master version control with these must-know Git commands and workflows.