Changes between Version 19 and Version 20 of StartModMaint


Ignore:
Timestamp:
Dec 13, 2013, 6:17:27 PM (9 years ago)
Author:
Beman Dawes
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • StartModMaint

    v19 v20  
    7171}}}
    7272
    73 === Fix a simple bug ===
     73=== Fix a simple bug directly on {{{develop}}} ===
    7474
    7575For simple bugs, particularly in projects with a single maintainer, it is common practice to fix bugs directly in the {{{develop}}} branch. Creating a test case with your favorite editor, testing the test case, fixing the bug, testing the fix, and then iterating if necessary is no different than with any programming environment.
     
    8383}}}
    8484
    85 === Fix a bug using a bug-fix branch ===
    86 
    87 Fixing a bug directly on the {{{develop}}} branch is fine, if that's the library's policy, but if the bug is messy, multiple maintainers are involved, interruptions are expected, or other complexities are present, then it is better practice to work on the bug in a separate bug-fix branch.
    88 
    89 {{{
    90 git checkout -b bugfix/complex-boo-boo
    91 }}}
    92 
    93 This creates the branch {{{bugfix/complex-boo-boo}}}, and switches to it. Incidentally, {{{bugfix/}}} is part of the name, not a directory specifier. The new branch is based on branch {{{develop}}} because the working copy was on branch {{{develop}}} at the time of the branch.
     85There are some significant disadvantages to this simple approach:
     86* The fix is now made to {{{develop}}} but you must remember to merge it to a release branch or directly to {{{master}}}. It is very easy to forget to do that merge, particularly if this is a mature library you are not working with very often.
     87* Users who need the bug fix right away are forced to jump through hoops to retrieve the fix from {{{develop}}}.
     88
     89Putting out a point release solves both of those problems. Read on...
     90
     91=== Fix a bug using a hot-fix branch ===
     92
     93Fixing a bug directly on the {{{develop}}} branch is fine, if that's the library's policy, but if the bug is messy, multiple maintainers are involved, interruptions are expected, or other complexities are present, then it is better practice to work on the bug in a separate branch. And doing that on a hot-fix branch solves the problems mentioned at the end of the prior section.
     94
     95The operational distinction between a bug-fix branch and a hot-fix branch is that a bug-fix branch is branched from {{{develop}}} and then at completion merged back to {{{develop}}}, while a hot-fix branch is branched from {{{master}}} and then at completion is merged to both {{{master}}} and {{{develop}}}. With either approach, the branch is deleted after it has been merged.
     96
     97{{{
     98git checkout master
     99git checkout -b hotfix/complex-boo-boo
     100}}}
     101
     102This creates the branch {{{hotfix/complex-boo-boo}}}, and switches to it. Incidentally, {{{hotfix/}}} is part of the name, not a directory specifier. The new branch is based on branch {{{master}}} because the working copy was on branch {{{master}}} at the time of the branch.
    94103
    95104Since the bug is complex, it may take some time to fix and may go through several cycles of fixes, tests, and commits.
    96105
    97 Once the bug is fixed and a final commit is done, then it is time to merge the {{{bugfix/complex-boo-boo}}} branch back into {{{develop}}}:
    98 
    99 {{{
     106Once the bug is fixed and a final commit is done, then it is time to merge the {{{hotfix/complex-boo-boo}}} branch into {{{master}}} and {{{develop}}}:
     107
     108{{{
     109git checkout master
     110git merge hotfix/complex-boo-boo
     111git push
    100112git checkout develop
    101 git merge bugfix/complex-boo-boo
    102 git push
    103 }}}
    104 
    105 The usual practice is to delete temporary branches like {{{bugfix/complex-boo-boo}}} once they have been merged:
    106 
    107 {{{
    108 git branch -d bugfix/complex-boo-boo
    109 }}}   
    110  
     113git merge hotfix/complex-boo-boo
     114git push
     115git branch -d hotfix/complex-boo-boo
     116}}}
     117
    111118=== Start work on a new feature ===
    112119