GIT Replace Branch With Another - gecko-8/devwiki GitHub Wiki
Note: in the following instructions we'll refer to the original main/master branch as and the branch we want to replace it with as .
- Switch to the new main branch
git checkout <new main> - Merge the original main branch into the new main branch
IMPORTANT: The "-s ours" switch makes sure we only use changes from the new main branch
git merge -s ours master - Switch to the original main branch
git checkout <original main> - Merge the new main branch into the existing one
git merge <new main> - The main branch will now match the new one