Executing a Git Release Workflow: Branching, Merging, and Tagging
Preparing the Local Environment and Synchronizing State
Verify the working tree is clean before initiating a release workflow:
git status --short
Return to the primary development line and fetch upstream changes to avoid divergnece:
git switch main
git fetch origin
git rebase origin/main
Brnaching and Development Phase
Establish an isolated track for the upcoming release candidate:
git checkout -b release/v0.9.1
Apply modifications, stage artifacts, and record the snapshot:
git add .
git commit -m "Feat: implement v0.9.1 target updates"
Synchronize the feature track with the remote repository:
git push -u origin release/v0.9.1
Integration and Merging
After validation confirms stability, integrate the release track into the baseline:
git switch main
git merge --no-ff release/v0.9.1 -m "Merge branch 'release/v0.9.1' into main"
git push origin main
Using --no-ff preserves the complete history of the release integration event.
Version Pinning
Attach an immutable annotation to the merged commit to mark the official build:
git tag -a v0.9.1 -m "Release version 0.9.1"
git push origin v0.9.1
The annotated tag captures metadata, authorship, and signing information when applicable.
Post-Release Cleanup
Remove temporary tracks to maintain repository hygiene:
git branch -d release/v0.9.1
git push origin --delete release/v0.9.1
Switch back to the main line to resume standard operations:
git switch main