branch-and-commit-methodology
Branch and Merging Strategy
Summary
We use the a branch and commit strategy that relies on many small commits that are then squashed into larger, explicitly described units of work before they are merged through the pull request mechanism.
Process
Developer clones the repository and wants to write code
Create a working feature branch for the work that is being done
git checkout maingit checkout working-<feature name>
As code is updated, make small commits for either clear units of change, or work in progress commits to capture unfinished work.
git commit ...
Always push work from this working branch often, to ensure work is stored in the cloud and not lost
git push -u origin <branch name>- the first timegit push- every other time
Finish the feature or work that is being done
Now, create a new branch to be used to clean up the commit history
git checkout -b finished-<feature name>
Clean up the the commit history using interactive rebase with squashing
git rebase -i <base commit>Use
pickorsquashto combine commitsUpdate the commit message so they follow the correct conventional commits format
Create a PR using the github cli
gh pr create
Review the PR with other devs
Merge to main
Last updated