git命令之git cherry-pick

项目场景:

使用git命令,合并代码时

问题描述

使用git命令,合并代码时,提示不能合并:

c 复制代码
PS D:\xxx\testDemo> git cherry-pick commint号
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:                                      
                                                                           
    git commit --allow-empty                                               

Otherwise, please use 'git cherry-pick --skip'
On branch master
Your branch is up to date with 'origin/master'.

You are currently cherry-picking commit commint号.
  (all conflicts fixed: run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

nothing to commit, working tree clean
PS D:\xxx\testDemo> 

原因分析:

  1. 修改的文件有代码冲突

解决方案:

就用提示的命令,先取消合并

c 复制代码
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

(有一种老牌方法,就是把 文件进行覆盖,这样可以保证 分支的代码都是一样的;

思考:什么场景用这种情况?)

相关推荐
leoZ23119 小时前
Git 集成实战完全指南(三):自动化 Commit 与 PR
大数据·git·elasticsearch
国服第二切图仔21 小时前
002-Claude Code 项目解读:入口与启动流程
linux·git·ubuntu
天空'之城1 天前
VS Code Git 工作树:告别频繁切分支,实现多分支并行开发实战方案
git·vscode·版本控制·嵌入式开发·开发效率·worktree·多分支管理
程序员爱德华1 天前
VSCode git/gerrit解冲突
git·vscode·gerrit
leoZ2311 天前
Git 集成实战完全指南(二):智能分支管理
大数据·git·elasticsearch
qq_452396232 天前
第六篇:《GitLab CI 进阶:多环境部署与环境变量管理》
git·ci/cd·gitlab
有想法的py工程师2 天前
GPG 密钥迁移指南:多私钥备份、批量导入与自动信任
git·github
浮江雾2 天前
Flutter第五节------Flutter开发环境配置与项目创建指南
开发语言·前端·git·学习·flutter·入门·函数
aramae2 天前
C++11:现代C++的里程碑
c语言·开发语言·c++·windows·git·后端
BerryS3N2 天前
VS Code Git 工作树:解锁多分支并行开发新体验
大数据·git·elasticsearch