Soundlly / Study

0 stars 0 forks source link

Hotfix 브랜치는 어떻게 해야 잘 쓰는걸까? #18

Open pjhjohn opened 6 years ago

pjhjohn commented 6 years ago

문제 상황

이미 배포된 SDK에서 이슈가 발생하여 긴급 수정할 항목이 생겼다. Git-Flow에 따르면, hotfix/hotfix-branch-name 브랜치를 master 브랜치로부터 생성하고, 이슈를 해결한 후 master develop 브랜치 모두에 머지한다.

이를 위해 hotfix/180329-resolve-negative-array-size-exception 브랜치를 만들고 문제를 해결한 후, 다음과 같이 해당 브랜치에서 master develop 브랜치로 각각 Pull Request를 올렸다:

Soundlly/BitsoundAndroidSDK#415 : into master

f833464  Provide Custom TestWatcher for All Test Units
385d186  Reproduce NegativeArraySizeException
7b770c7  Resolve NegativeArraySizeException

Soundlly/BitsoundAndroidSDK#416 : into develop

e406a05  Merge branch 'hotfix/180104-proguard-for-common-package'
4d5d1fd  (#380) v4.0.0
a0ed403  [#405] v4.1.0
f833464  Provide Custom TestWatcher for All Test Units
385d186  Reproduce NegativeArraySizeException
7b770c7  Resolve NegativeArraySizeException

이 때, master 브랜치로의 PR은 hotfix/... 브랜치의 생성 위치가 master이기 때문에 문제될 것이 없다. 물론 여러 개의 핫픽스가 동시에 master에서 생성되고, 그 중 일부가 머지되었을 경우, 나머지 핫픽스 브랜치에서 master로 머지하려 할 때 Conflict가 예상되지만, 이는 다른 핫픽스 브랜치를 업데이트된 master를 기준으로 rebase해서 업데이트하면 해결된다.

문제는 develop 브랜치로의 PR인이다. 충돌이 발생하는 경우, 이를 해결하기 위해서는 develophotfix로 머지해서 충돌을 해결한 후에 올리는 것인데, 그러면 develop 브랜치로의 PR의 Commits 탭의 항목에는 다음과 같이 충돌을 해결한 1개의 커밋만 추가된다:

e406a05  Merge branch 'hotfix/180104-proguard-for-common-package'
4d5d1fd  (#380) v4.0.0
a0ed403  [#405] v4.1.0
f833464  Provide Custom TestWatcher for All Test Units
385d186  Reproduce NegativeArraySizeException
7b770c7  Resolve NegativeArraySizeException
79c0d32  Merge branch 'develop' into hotfix/180329-resolve-negative-array-size…

여기까지는 좋다. 그런데 이제 master 브랜치로의 PR Commits 탭이 난리가 난다:

17cfa3c  Arrange Project Module Permissions
d664938  (#406) Arrange Project Module Permissions
bb76259  Revert Manifest Permission if Application Uses
b8b98d1  Firebase Crashlytics with Arranging Gradle Script
59f7d9d  (#407) Firebase Crashlytics with Arranging Gradle Script
279a274  Gather Return Statements with Nullable AppKey
4fc4238  Fetch ScheduleFile after Auth Verification
930dd6b  (#408) Fetch ScheduleFile after Auth Verification
b55506c  Use DebugLog for Kibana Debugging
060bd10  (#409) Use DebugLog for Kibana Debugging
270e927  Remove & Untrack Entire IntelliJ IDEA Config
956f468  Resolve RuntimeException from Test Apps Android O
53721ab  (#410) Resolve RuntimeException from Test Apps Android O
f8d775e  (#411) Remove & Untrack Entire IntelliJ IDEA Config
e397ef6  AndroidStudio Stable 3.1 with Kotlin 1.2.31
e9851fb  (#412) AndroidStudio Stable 3.1 with Kotlin 1.2.31
eeccec5  Prepend Date of Compilation for Untagged Build
ebae946  (#413) Prepend Date of Compilation for Untagged Build
ed123ab  Rollback Google Play Services Version to 11.8.0
47a4d07  Use Git Commit Count as VersionCode
0cf4f4c  (#414) Use Git Commit Count as VersionCode
f833464  Provide Custom TestWatcher for All Test Units
385d186  Reproduce NegativeArraySizeException
7b770c7  Resolve NegativeArraySizeException
79c0d32  Merge branch 'develop' into hotfix/180329-resolve-negative-array-size…

Q. 이 끔찍한 꼴을 보지 않으려면 어떻게 해야 할까??