Create and Sync a Feature Branch
Branch from the latest main, work locally, and publish the branch for review.
When to use
Use this flow whenever you pick up a ticket that requires isolated changes that will ship via pull request.
Pre-flight
- Main is protected and should be stable.
- You have a clean working tree (stash or commit any in-flight edits first).
Steps
-
Update
mainbefore you branch.git checkout main git pull origin main -
Cut a new branch using a descriptive name (team naming conventions help keep branches organized).
git checkout -b feat/logger-middleware -
Develop your changes and stage them incrementally.
git add src/logger.ts git commit -m "feat: add http request logging" -
Publish the branch and set upstream tracking so future pushes are simpler.
git push -u origin feat/logger-middleware
Verification
git statusreports that you are on the feature branch.- The branch appears in your remote (GitHub > Branches tab).
Follow-up
- Open a draft pull request early to start gathering feedback.
- Rebase your branch frequently to absorb new commits from
mainand reduce merge friction.