Dev Tools

Git Version Control

Tutorial Git lengkap untuk kolaborasi tim termasuk branching, merging, dan conflict resolution.

Git Version Control

Git adalah version control system yang essential untuk software development.

Instalasi Git

Linux

sudo apt install git

macOS

brew install git

Windows

Download dari https://git-scm.com/

Konfigurasi Awal

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Dasar Git Commands

# Inisialisasi
git init

# Clone repository
git clone https://github.com/user/repo.git

# Cek status
git status

# Stage files
git add .
git add filename.txt

# Commit
git commit -m "Initial commit"

# Lihat log
git log
git log --oneline

Branching

# Buat branch baru
git branch feature/login

# Switch branch
git checkout feature/login
# Atau dalam satu command
git checkout -b feature/login

# Hapus branch
git branch -d feature/login

Merging

# Di branch main
git checkout main

# Merge feature branch
git merge feature/login

Remote Operations

# Tambah remote
git remote add origin https://github.com/user/repo.git

# Push ke remote
git push origin main

# Pull dari remote
git pull origin main

Git Workflow

Feature Branch Workflow

main (production)
    ↑
    |
develop
    ↑
    |
feature/login

Pull Request

  1. Buat feature branch
  2. Push ke remote
  3. Buat Pull Request di GitHub/GitLab
  4. Review dan merge

Troubleshooting

Undo last commit

# Soft reset (hapus commit tapi keep changes)
git reset --soft HEAD~1

# Hard reset (hapus commit dan discard changes)
git reset --hard HEAD~1

Stash Changes

# Simpan sementara
git stash

# Restore stash
git stash pop

Best Practices

  1. Commit frequently - Small, frequent commits
  2. Write good commit messages - Conventional Commits
  3. Use .gitignore - Exclude unnecessary files
  4. Pull before push - Avoid conflicts
  5. Review changes before commit - git diff

Conventional Commits

feat: add user authentication
fix: fix login bug
docs: update README
style: format code
refactor: simplify auth logic
test: add user tests
chore: update dependencies
Butuh tools & layanan terkait?
Coba generator, lihat layanan, atau cek marketplace produk digital.

Rating & Komentar

Rata-rata: 4.4 / 5 • 10 rating

Beri Rating

Komentar

0 komentar
Belum ada komentar.
News
Headline terbaru (RSS)
Buka halaman
Memuat news…
Gagal memuat news. Coba refresh.

DenRama AI Assistant

Online

Halo! 👋 Saya asisten virtual DenRama.Net.

Ada yang bisa saya bantu tentang layanan IT, knowledge base, atau produk kami?

16:43