github合并master和main
一、背景
自建的github仓库存在两个分支:main和master,之前代码push到master分支,需将master分支上的代码合并到main分支。2021年8月后,github默认分支为main
二、步骤
git checkout main
# 切换到分支 'main'
# 您的分支与上游分支 'origin/main' 一致
git branch
# * main
# master
git merge master --allow-unrelated-histories
# 将master分支合并到main上
# Merge made by the 'recursive' strategy
git pull origin main
git push origin main
三、备注
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
github当前不支持git账号密码授权,需使用username+token