Git itu intimidating banget buat pemula. Tapi tenang, di tutorial ini aku bakal jelasin Git dari nol.
Git Itu Apa?
Git itu version control system. Bayangin punya “save point” di game, tapi untuk kode.
Install Git
Windows
Download dari git-scm.com
macOS
xcode-select --install
Linux
sudo apt install git
Basic Commands
git init # Buat repo baru
git add . # Add semua ke staging
git commit -m "msg" # Commit
git status # Check status
git log # History
git branch # List branches
git checkout -b name # New branch
git merge name # Merge branch
git push # Push ke remote
git pull # Pull dari remote
Cheat Sheet
| Command | Fungsi |
|---|---|
git init | Buat repo baru |
git add . | Add semua ke staging |
git commit -m "msg" | Commit |
git status | Check status |
git log | History |
git push | Push ke remote |
git pull | Pull dari remote |
Best Practices
- Atomic commits - Satu commit = satu fitur/fix
- Good commit messages - Jelas dan deskriptif
- Branch per fitur
- Pull before push
- .gitignore - Exclude file gak perlu
Conclusion
Dalam 30 menit, kamu udah belajar basic Git. Practice makes perfect!
Ada pertanyaan? Komen di bawah!