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)

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

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

相关推荐
带娃的IT创业者2 小时前
开源贡献:Fork与Pull Request的艺术
git·开源·github·版本控制
Joy T2 小时前
【Git进阶】告别混乱提交树:深入理解 Git Rebase 的底层逻辑与实战场景
git·rebase
西门吹-禅3 小时前
【git ssl error check process】
git·ssl
sanyii3131313 小时前
k8s工作负载-ReplicaSet控制器
java·git·kubernetes
薛不痒4 小时前
大模型(1):ollama&大模型相关介绍&开源平台&模型下载
人工智能·windows·git·python·深度学习
啊哈的哲学路途5 小时前
【git、gitee、github、gitlab 区别以及功能】
git·gitee·github
kyriewen8 小时前
别再直接 git push 了!这个"魔法"参数让你的代码质量翻倍
前端·git·命令行
蜡台8 小时前
Node Vue 项目开发常见问题解决
前端·javascript·vue.js·git·node
香水5只用六神8 小时前
【TIM】基本定时器定时实验(1)
c语言·git·stm32·单片机·嵌入式硬件·github
golang学习记9 小时前
IDEA 2026.1 EAP 4 发布:git操作更加丝滑了!
java·git·intellij-idea