Git & GitHubInteractive
Version your projects and collaborate with your team
A fully interactive section: type real Git commands in a practice terminal and watch the repository change in front of you — from your first commit to branches, merging, GitHub and pull requests.
- 24 lessons
- 7 chapters
- Arabic & English
Your progress
What's inside
Lessons go from the basics to advanced topics. Read them in order, or jump to what you need.
Chapter 1
Understanding Git
- 1Introduction to Git and GitHubDiscover the problem everyone has with keeping versions of a project, how Git solves it, and the difference between Git on your computer and the GitHub website.
- 2How Git WorksUnderstand the big idea behind Git: three areas (the working directory, the staging area and the repository) and commits that save complete snapshots of your project.
- 3Install and Set Up GitInstall Git on Windows, macOS or Linux, check the installation with git --version, then tell Git your name and email once.
- 4Terminal BasicsLearn the few terminal commands you need: finding where you are, moving between folders, and creating and reading files, before you start with Git.
Chapter 2
Daily Workflow
- 5Create a RepositoryTurn any folder into a Git repository with git init, meet the hidden .git folder that stores your project's whole history, and the git status command you'll use every day.
- 6The Staging Area (git add)Learn how to choose which changes go into the next commit with git add, and why the staging area exists at all.
- 7Your First CommitSave the first snapshot of your project with git commit, learn what a commit contains, and view the history with git log.
- 8Tracking Changes (git diff)See exactly what changed in your files before committing, with git status, git diff and git diff --staged.
- 9Writing Good Commit MessagesA good commit message is a note to your teammates and to your future self. Learn the rules professionals follow, and the Conventional Commits style.
- 10Undoing ChangesMade a mistake? No problem. Learn to unstage with git restore --staged, discard edits with git restore, and fix your last commit safely.
Chapter 3
Branching and Merging
- 11BranchesA branch is a parallel line of work where you can experiment safely without touching the main version. Learn to create branches and switch between them with git branch and git switch.
- 12Merging BranchesBring one branch's work into another with git merge, and understand the difference between a fast-forward merge and a merge commit.
- 13Resolving Merge ConflictsA conflict happens when two branches change the same line in different ways. No need to panic: learn to read conflict markers and resolve them step by step.
Chapter 4
GitHub and Remotes
- 14GitHub Account and First RepositoryCreate your GitHub account and get to know its interface, then create your first online repository and understand the difference between public and private.
- 15Pushing Your Project to GitHubConnect your local repository to GitHub with git remote add, upload your commits with git push, and learn the ways to authenticate: HTTPS, access tokens and SSH.
- 16Pull and FetchBring your teammates' work from GitHub: git fetch downloads new commits without touching your files, and git pull downloads them and merges them into your branch.
- 17Cloning a RepositoryDownload a complete copy of any GitHub repository to your computer with git clone, including its whole history and its connection to the source.
Chapter 5
Collaboration
- 18Pull Requests and the GitHub FlowLearn how professional teams work: a branch for every change, then a pull request that teammates review before it lands in main.
- 19Forks and Contributing to Open SourceContribute to projects you can't push to: create your own copy (a fork), clone it, then send your changes to the original project with a pull request.
Chapter 6
Essential Tools
- 20Ignoring Files (.gitignore)Tell Git which files it should never track, like the node_modules/ folder and the secrets in .env, with a .gitignore file.
- 21Exploring and Reverting HistoryTravel through your project's history with git log and git show, safely undo a bad commit with git revert, and learn when git reset fits better.
- 22More GitHub FeaturesGitHub is more than a place to store code: meet Issues, Projects, Releases, GitHub Pages and GitHub Actions.
Chapter 7
Reference and Next Steps