解决“fast-forward, aborting”问题

2023-02-12,,

1. 现象

对某一个远程仓库 git pull 过程中,报错如下:

# zl @ srv123 in ~/git/radxa/kernel [14:09:54]
$ git pull
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Total 5 (delta 4), reused 5 (delta 4), pack-reused 0
展开对象中: 100% (5/5), 580 字节 | 145.00 KiB/s, 完成.
来自 https://github.com/radxa/kernel
05483899648a..b902fb9b8f5e stable-5.10-rock5 -> origin/stable-5.10-rock5
* [新标签] 5.10.66-14-rockchip -> 5.10.66-14-rockchip
fatal: 无法快进,终止。

2 . 尝试 rebse 失败

 zl @ srv123 in ~/git/radxa/kernel [14:18:40] C:128
$ git rebase origin/stable-5.10-rock5
warning: 跳过了先前已应用的提交 b20c76419838
#[...忽略大量输出...]
warning: 跳过了先前已应用的提交 c5e33d713633
提示:使用 --reapply-cherry-picks 来包括跳过的提交
提示:Disable this message with "git config advice.skippedCherryPicks false"
自动合并 arch/arm64/boot/dts/rockchip/Makefile
冲突(内容):合并冲突于 arch/arm64/boot/dts/rockchip/Makefile
自动合并 arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
冲突(添加/添加):合并冲突于 arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts
error: 不能应用 8d8ce536694e... arm64: dts: rockchip: add ROCK 5B board
提示:Resolve all conflicts manually, mark them as resolved with
提示:"git add/rm <conflicted_files>", then run "git rebase --continue".
提示:You can instead skip this commit: run "git rebase --skip".
提示:To abort and get back to the state before "git rebase", run "git rebase --abort".
不能应用 8d8ce536694e... arm64: dts: rockchip: add ROCK 5B board # zl @ srv123 in ~/git/radxa/kernel [14:19:00] C:1
$ git status
交互式变基操作正在进行中;至 b902fb9b8f5e
最后一条命令已完成(1 条命令被执行):
pick 8d8ce536694e arm64: dts: rockchip: add ROCK 5B board
接下来要执行的命令(剩余 9 条命令):
pick bc4c96c590e6 arm64: rockchip_linux_defconfig: add general options
pick e712286fbba5 arm64: rockchip_linux_defconfig: enable network modules
(使用 "git rebase --edit-todo" 来查看和编辑)
您在执行将分支 'stable-5.10-rock5' 变基到 'b902fb9b8f5e' 的操作。
解决冲突,然后运行 "git rebase --continue")
(使用 "git rebase --skip" 跳过此补丁)
(使用 "git rebase --abort" 以检出原有分支) 未合并的路径:
(使用 "git restore --staged <文件>..." 以取消暂存)
(使用 "git add <文件>..." 标记解决方案)
双方修改: arch/arm64/boot/dts/rockchip/Makefile
双方添加: arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dts 修改尚未加入提交(使用 "git add" 和/或 "git commit -a") # zl @ srv123 in ~/git/radxa/kernel [14:21:24]
$ git rebase --abort

3. 切换到其他分支,然后删除本分支

# zl @ srv123 in ~/git/radxa/kernel [14:21:40]
$ git checkout release-4.4-rockpi4
正在更新文件: 100% (94089/94089), 完成.
切换到分支 'release-4.4-rockpi4'
您的分支与上游分支 'origin/release-4.4-rockpi4' 一致。 # zl @ srv123 in ~/git/radxa/kernel [14:22:01]
$ git branch -D stable-5.10-rock5
已删除分支 stable-5.10-rock5(曾为 c5e33d713633)

4. 然后重新 checkout (本地分支 track 远程分支)

# zl @ srv123 in ~/git/radxa/kernel [14:22:09]
$ git checkout --track origin/stable-5.10-rock5
正在更新文件: 100% (94123/94123), 完成.
分支 'stable-5.10-rock5' 设置为跟踪来自 'origin' 的远程分支 'stable-5.10-rock5'。
切换到一个新分支 'stable-5.10-rock5'

解决“fast-forward, aborting”问题的相关教程结束。

《解决“fast-forward, aborting”问题.doc》

下载本文的Word格式文档,以方便收藏与打印。