文章目录
1 问题背景
- commit之后,有文件冲突
- 然后执行 git fetch upstream
- 再执行 git rebase upstream/dev
- merge代码
- git push
- 提示当前不在分支
- git branch查看 (no branch, rebasing dev)
2 解决问题
- git rebase --continue
- git checkout dev(切换到dev)
- 提示有提交将丢失
Warning: you are leaving 2 commits behind, not connected to
any of your branches:
6e17ea522 merge error
ed21b7511 handle sp without leading sc when update
If you want to keep them by creating a new branch, this may be a good time
to do so with:
git branch <new-branch-name> 6e17ea522
-
git branch 新的分支 6e17ea522
-
git checkout 新的分支
-
git push orgin 新的分支:dev
-
提示需要commit: hint: (e.g. ‘git pull …’) before pushing again.
-
git pull origin dev:新的分支
-
提示
error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging. -
git commit -m ‘test’
-
再次 git push origin 新的分支:dev
成功!
3 心得
- 根据提示来,不要反抗