replace a branch with another branch git code example
Example 1: git switch branch to another branch
git checkout <name>
Example 2: git replace branch with another
# overwrite master with contents of feature branch (feature > master)
git checkout feature # source name
git merge -s ours master # target name
git checkout master # target name
git merge feature # source name