-
Notifications
You must be signed in to change notification settings - Fork 1
GIT Replace Branch With Another
Jason Lewis edited this page Jul 5, 2021
·
2 revisions
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