Jud Flow
Keeping a nice and tidy code repository makes me happy. Here’s the typical process I use to avoid messes:
- Create
my-sweet-new-feature
branch frommain
- Make some awesome code edits, then commit them
- Make some slightly less awesome edits, commit them also
- Run some tests, nothing works; debug and commit the fix
- Decide my originally awesome code isn’t so awesome; rewrite the whole feature and commit
- Tests pass locally, yay! Push
my-sweet-new-feature
to Github and create a pull request - Hrm, tests fail in pipeline; whoops, forgot a file; commit and repush
- Okay, tests pass now, so message team for review
- That’s a reasonable request, change made and committed
- Fine, we’ll use your naming convention; change made and committed
- Ugh, made a spelling error; committed
- Fixed moar typos
- Uggggggh, one last commit to fix spacing; pushed to Github
- Wha? Tests failing? :facepalm: forgot a file again
- Commit that file and push one last time for realz
- Tests pass, team reviews and approves, we’re good to go
- Pull an update of the
main
branch - Come back to
my-sweet-new-feature
and rewrite all the commits on top of updatedmain
; group edits into a clean subset of logical changes, one per commit, that makes it look like I wrote the code perfectly the first time, with nicely crafted commit messages that will mean something to some poor future developer that has to maintain my code ten years from now - Run tests to ensure everything still passes; it does
- Force push to the pull request, obliterating all those ugly prior commits with these nice clean ones
- Try to merge the branch to
main
with fast-forward only option, forget that Github doesn’t support it (curse you Github! even flipping CodeCommit supports fast-forward only merging) - Fast-forward merge
my-sweet-new-feature
to main locally so my final commit signatures are preserved - Try to push
main
to Github, but it fails because the branch is protected - Unprotect
main
temporarily, repush - Dang it, someone merged new changes since step 17; repull
main
and rebase my branch - Re-push my final changes and re-protect
main
See how easy that is? No excuses moving forward, my friends!