Merge my finished branch into main and push
When to use this: The work on your branch is done and tested, and you want it live on main (and so on Vercel production).
main deploys to production. Make sure the branch preview looks right first. Before you start
Steps
-
Switch to main and update it
terminalgit switch main git pullMerge into a fresh
mainso you do not create conflicts or a rejected push. -
Merge the branch
terminalgit merge my-branchCombines the branch into
main. Ifmaindid not move, Git fast-forwards with no extra merge commit.Expected output
Updating 3f2a1b9..8c4d7e0 Fast-forward
-
Push
terminalgit pushPublishes
main. Vercel starts a production deployment. -
Tidy up the branch (optional)
terminalgit branch -d my-branch git push origin --delete my-branch-drefuses to delete unmerged work, which is a good safety check.
How to verify it worked
git log --oneline -n 5onmainincludes your branch's commits.- The Vercel dashboard shows a new Production deployment that succeeded.
How to undo it
Pushed and the site is broken: roll the site back in Vercel first (see the rollback scenario), then undo in Git with a revert commit.
git revert -m 1 <merge-commit-id>Common errors and fixes
CONFLICT while merging Resolve it (merge-conflict scenario) and commit. Next time, run 'update branch with main' first so conflicts are fixed on the branch. push rejected main moved on GitHub. git pull, then push again. Q&A
What is the difference between a fast-forward and a merge commit?
A fast-forward just moves main to your branch's tip because main has nothing new. A merge commit is created when both sides have new commits.
How do I always get a merge commit, even when fast-forward is possible?
git merge --no-ff my-branch. It keeps the branch visible as a unit in history.