84.17 Git Merge Main into Branch
20201029 To re-synchronise a branch with updates that have been made to the main branch on the repository, 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 validator $ git merge main $ git push
Notice that we could skip the first two lines 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 validator $ git merge origin/main $ git push
Your donation will support ongoing development 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-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.