Merge a Feature Branch Back to Main

Fast-forward or rebase-merge changes safely after review is complete.

When to use

Reach for this flow once your pull request is approved and all checks are green.

Steps

  1. Ensure your feature branch is fully up to date with main.

    git checkout feat/logger-middleware
    git fetch origin
    git rebase origin/main
  2. Resolve any conflicts locally, rerun tests, and force push the reconciled branch.

    git add .
    git rebase --continue
    git push --force-with-lease
  3. Merge via GitHub using the organization-approved strategy (for example, rebase + merge for a linear history).

  4. Pull the updated main locally to stay current.

    git checkout main
    git pull origin main

Verification

  • The GitHub pull request shows "Merged".
  • git log --oneline -5 on main includes your feature commits.

Follow-up

  • Delete the remote feature branch if your team prefers a tidy namespace.
  • Check deployment dashboards or monitoring tools if a release went out with this merge.