Free lesson · 10 minutes
Git in 10 minutes
Git saves snapshots of your project so you can undo mistakes, try ideas safely and work with other people. Here are the three commands you'll use every day.
1. Start tracking a folder
Open a terminal in your project folder and run:
git initGit creates a hidden .git folder. Your files are untouched; Git is just watching now.
2. Save a snapshot (a commit)
Pick the changes to save, then save them with a short message:
git add index.html
git commit -m "Fix the title"git status shows what changed. git log --oneline lists your snapshots.
3. Try ideas safely on a branch
git switch -c idea # new branch, same files
# ...edit and commit as usual...
git switch main
git merge idea # bring the idea into mainIf the idea doesn't work out, switch back to main and nothing is lost.
That's it
init, add, commit, switch, merge. You now know the Git most people use every day.