方式1
当前的开发分支:feature-knowledge-api-ghh,主线分支:dev-sir-cloudsoc
① 切换到主线分支dev-sir-cloudsoc:
git checkout dev-sir-cloudsoc
② 拉取远程主线分支dev-sir-cloudsoc到本地的主线分支dev-sir-cloudsoc :
git pull --rebase
③ 切回到当前的开发分支feature-knowledge-api-ghh:
git checkout feature-knowledge-api-ghh
④ 拉取远程分支dev-sir-cloudsoc 的代码:
git rebase dev-sir-cloudsoc
⑤ 将当前开发分支分支feature-knowledge-api-ghh提交到远程分支feature-knowledge-api-ghh:
git push origin feature-knowledge-api-ghh -f
方式2
① 切换到远程分支:dev-sir-cloudsc,然后查看远程的提交记录
git checkout dev-sir-cloudsoc
git log --oneline --graph
② 将远程拉取的代码与本地分支合并:
git rebase dev-sir-cloudsoc feature-knowledge-api-ghh
③ 如果出现冲突,解决冲突
④ 解决完冲突,然后继续合并:
git rebase --continue
⑤ 将代码提交到远程:
git push origin feature-knowledge-api-ghh -f