Assume a single file gets a few changes related to different issues. We can easily just post git commit with a note to describe each change for each issue, push that, and remind ourselves not to do that again.
Depending on how complex the changes are, I use this pattern to give each change its own commit:
- Copy the finished working file to a new Final file.
- Revert the working file back to its last commit state.
- Diff the working file and the Final file, and hand-merge individual lines for an issue.
- Commit with a clean comment for a single issue.
- Repeat as required.
- Delete the Final file as it's now just a copy of the current working file.
Is there a better way to do this, other than "don't do that"? In short, I'm cherry-picking within a single file. But as any developer knows, changes can spread across multiple files, and sometimes it's difficult to avoid making a change right now when we're looking right at a line that needs to be changed, compared to flagging it and coming back later for a dedicated change/commit. Thanks.