Git Flow 03 – Hotfix

Lanjutan dari:
Git Flow 01 – Intro
Git Flow 02 – Release

Kalo setelah rilis ternyata ada bug yang harus secepatnya dibenerin, kita benerin bug di hotfix-branch. Kalo bug-nya fatal mungkin kita perlu rollback dulu production-server ke versi sebelumnya.

Terus jalanin perintah berikut untuk bikin hotfix-branch:

git flow hotfix start (nama hotfix)

Contoh:

$ git flow hotfix start 'fix-title'
Switched to a new branch 'hotfix/fix-title'

Summary of actions:
- A new branch 'hotfix/fix-title' was created, based on 'master'
- You are now on branch 'hotfix/fix-title'

Follow-up actions:
- Start committing your hot fixes
- Bump the version number now!
- When done, run:

     git flow hotfix finish 'fix-title'

Kita bener-benerin bug & jalanin juga build task, dll seperti di release-branch. Untuk QA, kita bisa upload/deploy ke staging-server.
Terus kalo udah di-approve oleh QA, kita tutup pake perintah di bawah:

git flow hotfix finish (nama hotfix)

Kaya begini:

$ git flow hotfix finish
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Merge made by the 'recursive' strategy.
 index.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Switched to branch 'develop'
Your branch is up-to-date with 'origin/develop'.
Merge made by the 'recursive' strategy.
 index.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Deleted branch hotfix/fix-title (was c0f5dd0).

Summary of actions:
- Hotfix branch 'hotfix/fix-title' has been merged into 'master'
- The hotfix was tagged 'fix-title'
- Hotfix tag 'fix-title' has been back-merged into 'develop'
- Hotfix branch 'hotfix/fix-title' has been locally deleted
- You are now on branch 'develop'

Sekarang tinggal push & deploy lagi.

git push origin master --tags

Repo sekarang jadi begini:

Hotfixed

Lebih dari Satu Bug

Kalo ada lebih dari satu bug yang ditemuin setelah rilis, kita bisa kerjain masing-masing di branch tersendiri yang asalnya dari branch hotfix. Jadi pas bikin hotfix-branch kita bisa pake nomor versi minor aja biar generik. Misalnya, karena bug ada di v1.0, hotfix kita kasih nama v1.0.1.

git flow hotfix 'v1.0.1`

Dari sini kita bikin branch untuk masing-masing bug.

git checkout -b hotfix/bug-01

Dan untuk bug yang lain:

git checkout -b hotfix/bug-02

Setelah semua bugfix selesai & di-merge ke hotfix/v1.0.1, selesaikan proses hotfix seperti di atas.

Also in this category ...


Leave a Reply

Your email address will not be published. Required fields are marked *