Wednesday's email<\/a>, someone said, \"It sounds like you and I use git very differently.\" So, I wanted to explain what my typical Git workflow is.<\/p>\n\nI used to use Git Flow, but now, I almost never create a new branch when starting a new task.<\/p>\n\n
I keep my workflow as simple as possible by using trunk-based development and working on a single branch as much as I can.<\/p>\n\n
Before I start, I make sure any uncommitted changes are committed or reset and that the automated tests, static analysis, coding standards checks, etc., are passing so I know I'm starting from a good place.<\/p>\n\n
Then, I start working on the task.<\/p>\n\n
I like to work in small steps and make small, regular commits, but I don't always push each individual commit to the remote repository.<\/p>\n\n
Sometimes, I'll make a number of \"work in progress\" commits and squash them into one before pushing them.<\/p>\n\n
I want the time between making and pushing the commit to be as short as possible, and I want each commit to be deployable.<\/p>\n\n
If I'm doing test-driven development, I'll typically commit each time a test is passing - whether it's adding a new test or extending one.<\/p>\n\n
I run any tests often whilst writing code to ensure they pass, either using a watch command or a keybinding in Neovim.<\/p>\n\n
I won't push a commit that would cause the code to not work, a test to fail, or block any other (potentially more urgent) changes from being pushed to production.<\/p>\n\n
If I push a commit that breaks the CI pipeline, I'll fix it quickly, which is usually possible as the changes are small.<\/p>\n\n
If not, I'll revert the commit to get back to a deployable state as quickly as possible.<\/p>\n\n
If I'm going to add a feature flag, I'll usually know that in advance and avoid rushing to add one later if a more urgent task comes in.<\/p>\n\n
By keeping each commit in a working and deployable state, a change can be feature flagged and deployed but not activated until the feature flag is enabled.<\/p>\n\n ",
"summary": null
}
],
"feeds_item": [
{
"imported": "1970-01-01T00:33:45+00:00",
"guid": null,
"hash": "1fdb0bb1e22238ec9d831d2b2a3af864",
"target_type": "feeds_feed",
"target_uuid": "90c85284-7ca8-4074-9178-97ff8384fe76"
}
]
}