FILE: materi-19.module

Git Advanced - Branching dan Workflow

Lebih dari add commit push. Branching strategy, merge vs rebase, conflict resolution.

RUNTIME: 26m LEVEL: intermediate STATUS: ACTIVE
> GIT ADVANCED $ Branching and workflow [OK] Module loaded successfully [INFO] Ready for next stage

1. Branching Strategy

Trunk-based (deploy continuous). GitFlow (release-based). GitHub Flow (feature branch ke main). Pilih sesuai workflow team. Trunk-based modern, GitFlow legacy untuk release siklus panjang.

2. Merge vs Rebase

Merge: simpan history asli. Rebase: rewrite history jadi linear. Pull rebase lebih bersih. Rebase only on private branch. Jangan rebase shared branch (collaborative).

3. Conflict Resolution

Git tidak bisa auto-merge file yang diubah di kedua branch. Markers <<<<<<< HEAD == >>>>>>> branch. Edit manual, hapus markers, save, git add, continue rebase atau merge.

4. Advanced Commands

git stash (simpan WIP). git cherry-pick (ambil 1 commit dari branch lain). git reflog (recovery commit hilang). git bisect (find bad commit). git rerere (remember resolution).

5. Pull Request Workflow

Branch dari main. Commit clean. Push. Open PR di GitHub. Code review. Address feedback. Squash merge. Delete branch. Repeat. Standar di hampir semua tim modern.

Practical Mission

  1. Setup repo dengan branch protection
  2. Praktek rebase 5 commit
  3. Resolve conflict eksperimen
  4. Pelajari git rerere
  5. Kontribusi ke open source dengan PR

Recap Module