Skip to content

checkout

Follow this workflow when creating new branches for development work.

PrefixPurposeExample
feature/New features or enhancementsfeature/user-auth
chore/Maintenance, refactoring, tooling, docschore/update-deps
hotfix/Bug fixes, urgent patcheshotfix/null-pointer-fix
  • Use lowercase with hyphens: feature/add-user-auth not feature/AddUserAuth
  • Keep names short but descriptive (2-4 words)
  • Reference issue numbers when applicable: hotfix/fix-login-123

Before creating a new branch, verify you’re in a clean state.

Terminal window
git branch --show-current

If not on main: You may be in the middle of another task. Either:

  • Finish and commit current work, then switch to main
  • Stash changes with git stash if you need to switch temporarily
  • Abort if you should complete the current task first
Terminal window
git status --porcelain

If there are changes: Do not create a new branch. Either:

  • Commit the changes to the current branch
  • Stash with git stash push -m "WIP: description"
  • Discard if truly unwanted with git checkout .
Terminal window
git pull origin main

This ensures your new branch starts from the latest code.

Only after all checks pass:

Terminal window
git checkout -b <prefix>/<branch-name>
Terminal window
# Starting a new feature
git checkout -b feature/oauth-login
# Maintenance task
git checkout -b chore/prettier-config
# Bug fix
git checkout -b hotfix/fix-auth-redirect
Terminal window
# 1. Ensure you're on main
git checkout main
# 2. Pull latest changes
git pull origin main
# 3. Create and switch to new branch
git checkout -b feature/add-notifications

Stop and reconsider if:

  • You have uncommitted changes - Commit or stash first
  • You’re not on main - You might be abandoning work in progress
  • Main is behind remote - Pull first to avoid merge conflicts later
  • The task is trivial - Single-line fixes might not need a branch
SituationAction
On main, clean stateSafe to create branch
On main, uncommitted workCommit or stash first
On feature branchFinish current work or stash
Main behind remotegit pull origin main first
Need to switch temporarilygit stash then switch