Published on

How to Sync a Branch with Remote Main

Authors
  • avatar
    Name
    Gene Zhang
    Twitter

Sync main branch with remote main branch

Suppose you’re currently on branch A. You want to update your local main to match origin/main, without doing git checkout main. Here are some commands:

git fetch <remote> <src-ref>:<dst-ref>
git fetch origin main:main