Fork me on GitHub
I ❤️ MamaTux!
Skip to main content

Git fast forward without checkout

TIL an easy way to update a local branch with upstream changes, without checking it out.

Say you are working in a branch called feature, and you want your main branch to be updated with the latest changes from origin/main.

git fetch <remote> <from branch>:<to branch>

So in our case I would simply do:

git fetch origin main:main