Our use case here is to re-synchronise a branch with updates that have been made to the main branch on the repository.
git fetch origin main:main git merge main
Here, origin is an alias on our local computer for the remote repository.
Old Recipe A previous incantation was to first ensure the local main branch has been updated using a checkout and pull for the main branch. Then checkout the branch of interest and merge from the updated local main. We can then push the merges back to the remote repository’s version of the branch. The commits are those that were committed by others to the remote repository’s main branch.
git checkout main git pull git checkout kayon/validator git merge main git push
Notice that we could skip the first two lines of this incantation and change the merge to merge origin/main to also effect a merge from the remote main into the current branch. This will not then update the local copy of main.
git checkout kayon/validator git merge origin/main git push
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0