程序员社区

Git 当前分支落后主线分支的解决方法

方式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

赞(1) 打赏
未经允许不得转载:IDEA激活码 » Git 当前分支落后主线分支的解决方法

相关推荐

  • 暂无文章

一个分享Java & Python知识的社区