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
-
Ensure your feature branch is fully up to date with
main.git checkout feat/logger-middleware git fetch origin git rebase origin/main -
Resolve any conflicts locally, rerun tests, and force push the reconciled branch.
git add . git rebase --continue git push --force-with-lease -
Merge via GitHub using the organization-approved strategy (for example, rebase + merge for a linear history).
-
Pull the updated
mainlocally to stay current.git checkout main git pull origin main
Verification
- The GitHub pull request shows "Merged".
git log --oneline -5onmainincludes 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.