Courses / Beginner
Git & GitHub in Practice
Commits, branches, merges and pull requests, and how to undo almost anything without panicking.
8 lessons4 hours355k learnersCertificate with Pro
Code you'll write
git init my-project
cd my-project
echo "# My project" > README.md
git add README.md
git commit -m "Start the project"
git switch -c feature/login
# ... edit files ...
git commit -am "Add login form"
git switch main
git merge feature/login
git restore notes.txt # throw away unstaged changes
git restore --staged notes.txt # unstage, keep the changes
git revert HEAD # undo the last commit with a new one