33.22 Git Merge Main into Branch
20230317
Our task is to re-synchronise a branch with updates that have been made to the main branch of the repository.
A simple incantation is to fetch the latest from the remote main branch into the local main branch and then merge it into the current branch:
Here, origin is an alias on our local computer for the remote repository.
Following this up with a push 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.
A similar incantation is to update the local main branch using a checkout and pull. Then checkout the branch of interest and merge from the updated local main.
We could skip the first two steps and merge from
origin/main
to effect a merge from the remote main into the current
local branch. This will not update the local copy of main.
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