Skip to content

Gitflow Workflow

Panduan lengkap Gitflow — branching strategy untuk tim developer

Gitflow adalah model branching yang terstruktur untuk mengelola pengembangan fitur, rilis, dan hotfix secara paralel. Cocok untuk tim yang punya siklus rilis terjadwal.

Diagram Alur

Berikut visualisasi alur Gitflow:

gitGraph
    commit id: "init"
    branch develop
    commit id: "chore: setup"
    branch feature/auth
    commit id: "feat: login"
    commit id: "feat: register"
    checkout develop
    merge feature/auth
    branch feature/api
    commit id: "feat: endpoints"
    checkout develop
    merge feature/api
    branch release/v1.0
    commit id: "chore: bump version"
    commit id: "fix: typos"
    checkout main
    merge release/v1.0 tag: "v1.0.0"
    checkout develop
    merge release/v1.0
    branch hotfix/critical
    commit id: "fix: security"
    checkout main
    merge hotfix/critical tag: "v1.0.1"
    checkout develop
    merge hotfix/critical

Branch Categories

BranchSourceMerge ToLifetime
mainPermanent
developmainmainPermanent
feature/*developdevelopTemporary
release/*developmain + developTemporary
hotfix/*mainmain + developTemporary

Rules

  • main selalu dalam keadaan production-ready
  • develop adalah branch integrasi untuk fitur yang sudah selesai
  • Feature branch dibuat dari develop, di-merge kembali ke develop
  • Release branch digunakan untuk persiapan rilis — hanya bug fixes, tidak ada fitur baru
  • Hotfix dibuat dari main untuk critical fixes, di-merge ke main dan develop

Contoh Flow

# Mulai fitur baru
git checkout develop
git checkout -b feature/payment-gateway

# Kerjain fitur
git add . && git commit -m "feat: add payment gateway integration"
git add . && git commit -m "feat: add payment confirmation page"

# Selesai, merge ke develop
git checkout develop
git merge feature/payment-gateway
git branch -d feature/payment-gateway

# Persiapan rilis
git checkout -b release/v1.2.0
# fix minor bugs, bump version
git commit -m "chore: bump version to 1.2.0"
git checkout main
git merge release/v1.2.0
git tag v1.2.0
git checkout develop
git merge release/v1.2.0
git branch -d release/v1.2.0