Git staging workflow & pristine version control engineering
Context of the problem
Now that the system is getting to its final shape one of the most important tools it should integrate is git, but how to do it properly to ensure a pristine commit history to understand the project, its progression, what has been implemented and how the project as evolved over time.
Also easily look backwards for quickly identification of the implementation details we are looking for. Nor in a messy uncontextualized way but rather having clear context on what are those changes related to, which requisite is being implemented, refactor or updated
Managing docs and code within the same repository carries the risk of “micro commit bloat” only small work and temporary struggle that doesn’t carry a significant weight when backward looking in the future fill the commit history. When reviewing you don’t what to see hundreds of micro commits that doesn’t actually inform of a complete feature.
I’ve analize the possible architectural decision including:
- Workspace squashing and isolated staging of wip commits
- Git worktrees
- Clean commit guidelines
- Clean Room Extraction: 2 branches one for the workspace, containing all the wip messy commits.
Edge cases
But the one that must be picked is the one that adresses the edge cases:
- Probable cross device synchronization commits that should not be part of the final commit history.
- Another key edge case is the synchronization of the cloud repository and the conflict it might cause with the overall sync and the atomic commit history.
- Handling two REQs that modify the same file in different lines
- Complete vision of the doc files from the markdown renderer
The decision
The final decision combines some of the previously mention alternatives and discards others but to make it short the solution is to use worktrees, one per requirement implementation and then clean it out, but this also comes with the frictions of having to update the symlink connection to the markdown editor of preference.
Visually explained the architecture is in a digrama below
Benefits
Semantic commits
The repository becomes self-documenting. Generating >“release notes”, “architectural change log” or revising >the project evolution becomes a mathematical query:
git log --grep="^type"
Structural Bracket Identifier
This makes it possible to audit the overall evolution of a >specific requirement implementation or architectural >decision over the project life by using git log --grep="[ID]". Ease the debugging process and version control >navigation.
Git-Tree
Concurrent file work history collapse solution: by using >the git-tree the edge case of losing track of multi line >edits that belong to different REQs in the same file is >handled gracefully by the work tree capabilities
Dashboard blindness solution: Eliminates dashboard >blindness by using the symlink connection
Workflow & the custom Script
Finding paths to create symlinks, moving trees to a parent folder so the development can began, the squashing of the commits for a clean history and the merge of wortrees to the main branch migth represent minutes of administrative friction. So the implementation of a script that ease the friction parts of the workflow to ensure the developer never gets out of flow due to administrative stuff is a foundational add on to the system.