Skip to main content

Git Workflow (Tim)

:::info Status Living — cara kerja Git sehari-hari. Ringkasan proses: SDLC §6. Setup tool: Dev Setup. :::

FieldValue
Version0.3.1
Last updated2026-09-24

Aturan singkat​

  1. Kerja di branch sendiri → buka Pull Request ke main. Jangan push langsung ke main.
  2. PR kecil, satu concern. Minta minimal 1 review; CI harus hijau sebelum merge.
  3. Setelah merge, branch remote otomatis terhapus — cukup bersihkan branch lokal.
  4. Jangan commit secret / .env.

Branch​

git checkout main && git pull
git checkout -b feature/nama-singkat
PrefiksContoh
feature/feature/attendance-clock-in
fix/fix/jwt-expire-handling
chore/chore/eslint-config
docs/docs/dev-setup-windows

Commit & PR​

git add path/ke/file
git commit -m "feat: endpoint POST /leaves untuk karyawan"
git push -u origin HEAD
# lalu buka PR di GitHub, atau: gh pr create

Pesan commit fokus mengapa (boleh pakai feat: / fix: / chore: / docs:).
Jika Husky/pre-commit gagal: perbaiki dulu — jangan --no-verify.

Isi PR: ringkasan singkat + cara verifikasi (test / screenshot UI jika perlu).

Setelah merge:

git checkout main && git pull
git fetch --prune
git branch -d feature/nama-singkat

Sync & konflik​

git fetch origin
git merge origin/main

Kalau konflik: selesaikan di editor → git add → git commit → jalankan lint/test lagi → push.
git push --force ke main dilarang. Di branch sendiri, pakai --force-with-lease hanya jika yakin.


Multi-repo​

RepoInstall / runCatatan
backendbunOpenAPI source of truth
web / mobilenpmSetelah API berubah: npm run api:sync (butuh gh auth)
docsbunDokumentasi

API dulu di backend, klien follow-up di PR terpisah. Link PR ke issue/board bila ada.


Jangan​

  • Push / commit langsung ke main
  • Secret, dump DB, data pribadi di Git
  • PR besar berhari-hari tanpa sync main
  • Lewati Husky tanpa alasan
  • Biarkan CI merah di main

Cheat sheet​

git status
git diff
git checkout main && git pull && git checkout -b feature/foo
git stash -u && git stash pop
git reset --soft HEAD~1 # batalkan commit terakhir (belum push), simpan perubahan

Referensi​