1. Mis on Git?
▼Git is a free, open-source version control system. See jälgib iga failides tehtud muudatust, et saaksid vea korral alati naasta varasema versiooni juurde.
It was created in 2005 by Linus Torvalds, sama inimene, kes lõi Linuxi! Git on maailma populaarseim versioonihaldussüsteem.
Imagine you're writing a story. Every time you finish a chapter, you take a photo (snapshot) of the whole notebook. If you make a mistake later, you can look back at any photo to see what the story looked like before. Git does the same for your code and files!
In a video game, you save your progress at certain points. If your character dies, you restart from the last save. In Git, every time you "commit," you create a save point for your project!
The name "Git" is British slang for a silly person. Linus Torvalds joked that he names his projects after himself!
2. Miks kasutada Git'i?
▼Git solves some very common problems that every developer faces:
Varem salvestasid inimesed faile nii: project_v1.zip, project_v2_final.zip, project_v2_final_REALLY_final.zip... See oli segane ja kaootiline!
With Git, you get:
Go back to any previous version
Paljud saavad sama projektiga töötada
See who changed what and when
Try new ideas without breaking things
3. Giti paigaldamine
▼Git works on all operating systems. Here's how to install it:
Linux (Ubuntu / Debian)
Ava terminal ja sisesta:
Windows
Download from git-scm.com and run the installer. Keep all the default settings. This gives you "Git Bash" — a special terminal for Git.
macOS
Ava terminal ja sisesta:
If Git is not installed, macOS will ask you to install it.
Ava terminal ja sisesta git --version. Kui kuvatakse versiooninumber, oled valmis!
4. Esmane seadistamine
▼Before using Git, you need to tell it who you are. This information appears in every commit you make.
--global means this setting applies to ALL your projects on this computer. You only need to do this once!
5. Giti töövoog (3 ala)
▼Git has 3 olulist ala where your files live. Understanding these is the key to understanding Git!
Working Directory = Your room with clothes everywhere.
Staging Area = The pile of clothes you've chosen to pack.
Repository = The locked suitcase, safely stored.
git add = picking clothes from your room → pile.
git commit = putting the pile into the suitcase and locking it.
6. Essential Git Commands
▼Starting a Project
Muudatuste tegemine
Viewing History
Kirjuta alati selged sissekandeteated, mis selgitavad what you changed and why. Võrdle neid:
❌ "fix stuff" — vague, unhelpful
✅ "Fix login button not working on mobile" — clear and useful!
7. Branches
▼A branch is like a separate copy of your project where you can try new things without affecting the main code.
Think of a tree. The trunk is your main project (called main branch). When you want to try something new, you grow a branch. Kui haru kasvab hästi, saad selle tüvega tagasi liita. Kui mitte, võid selle lihtsalt maha lõigata!
Sometimes two people change the same line in the same file. Git can't decide which version to keep — this is called a merge conflict. Pead käsitsi valima, millised muudatused alles jätta, ning seejärel tulemuse kinnitama.
8. Remote Repositories & GitHub
▼So far, everything has been on your computer (kohalikult). Aga kui tahad:
• Share your code with others?
• Have a backup in the cloud?
• Work on the project from another computer?
That's where remote repositories come in! Popular hosting services include GitHub, GitLab, ja Codeberg (avatud lähtekoodiga!).
Kohalik hoidla
Remote Repo
While GitHub is the most popular, there are great open-source alternatives like Codeberg (codeberg.org) ja Gitea that you can even host yourself!
9. Try It Out! (Interactive Terminal)
▼Type Git commands below and see what happens! Try commands like: git init, git status, git add, git commit, git log, git branch
10. Sobitamismäng
▼Drag each Git command to its correct description!
Commands
What It Does
11. Mälukaardid
▼Click each card to flip it and learn what each term means!
12. Lõputest
▼Test your knowledge! Choose the correct answer for each question.
13. Giti spikker
▼Keep this handy! These are the most important Git commands you'll use: