Git and Github: Commits, Merges, PRs and more
Here is a roundup of all the best practices, policies and processes for collaborating as a team with git, Github and updates.
Use Semantic Versioning
According to semver.org, semantic versioning follows this convention: MAJOR.MINOR.PATCH
- MAJOR version when you make breaking changes
- MINOR version when you make additions that are backwards compatible
- PATCH (aka BUG) when you make backwards compatible
- [Optional] HOTFIX when you just need something to get fixed and go live as fast as humanly possible
- This should be used incredibly sparingly and with strongly justified reasoning.
It is worth noting that a repo’s package.json and style.css versions may be out of sync. Updating packages, even if the package itself contains a breaking change, may not always result in a change to the theme code. Similarly, updating packages may not even necessarily warrant updating the theme’s PATCH version.
Create new branches from the default branch
Obviously, there will be times when this doesn’t apply, but as a general rule, all branches (regardless of semver number) should start from the default branch (often called main, sometimes called master).
Pull Requests
As of July 1, 2025, pull requests should always be regular merge commits until merging into main/master, in which case they should probably be squash commits.
Order of Operations
Branches should be merged into dev, up through stg and finally to main. Once code is committed to dev, it’s on a Senior Web Developer to take the feature live to main. Before any merging happens, the dev branch should be reset to match where the main branch is at.
Make sure to drop a message in the #webdev Slack channel to make sure this is good to go!
Command Line Process
Note: branch names are assumed to be dev and main, respectively, but this may not always be the case across every repo.
- Fetch the latest updates:
git fetch origin - Check out the
devbranch locally:git switch dev- If you don’t have a local
devyet:git checkout -b dev origin/dev
- If you don’t have a local
- Reset
devto matchorigin/mainexactly:git reset --hard origin/main- This makes your local
devbranch matchorigin/maincompletely.
- This makes your local
- Force-push the cleaned
devback to GitHub:git push origin dev --force- This overwrites
origin/devto matchorigin/main.
- This overwrites
VS Code GUI Process
Step 1: Sync your dev and main branches (spinner icon)

Step 2: Switch to your dev branch

Step 3: Open your CLI and type the following:
git reset --hard origin/mainOnce you do this, your dev branch may have some code changes to pull down. Do not sync them up as that will undo what you just did.

Step 4: Continuing in your command line, force push the changes up to Github
git push origin dev --forceYou can confirm this worked by going to the dev branch on Github and you should see the following message: “This branch is up to date with main“.
