Sometimes I discover that a commit I made two months ago had a bug. So I write a fix for the bug, but then I must choose one these ways of committing it:
I can commit the fix directly onto the main up-to-date branch (the trunk).
I can use a branch at the point of the original buggy commit, and commit the fix immediately after it. Then I merge the branch into the trunk.
(This approach is sometimes recommended if the bug was made on an existing "feature branch".)
(Wildcard) I could use
--fixup
to mark the association, but I will be unable to rebase because invariably the history has already been shared.
I can see some pros and cons with each approach, but I am wondering if experienced users have more to share than I can imagine.
In short my question is: Do any organisations find approach #2 sufficiently useful that they adopt it as standard?
(Outside of the case of maintaining an older release, where it would probably be the obvious choice to fix on the old release branch and then merge into the later releases and the trunk, when possible.)