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

  1. Update main before you branch.

    git checkout main
    git pull origin main
  2. Cut a new branch using a descriptive name (team naming conventions help keep branches organized).

    git checkout -b feat/logger-middleware
  3. Develop your changes and stage them incrementally.

    git add src/logger.ts
    git commit -m "feat: add http request logging"
  4. Publish the branch and set upstream tracking so future pushes are simpler.

    git push -u origin feat/logger-middleware

Verification

  • git status reports 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 main and reduce merge friction.