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)

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

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

相关推荐
_codemonster2 小时前
Git 最常用操作和原理
大数据·git·elasticsearch
_codemonster12 小时前
.git文件夹里所有文件详解
git
01杭呐12 小时前
一次错误分支合并导致 `master` 变脏的排查与修复
git
_codemonster13 小时前
git本地以及github查看历史版本、版本回退
git·github
周小码1 天前
10分钟搭建私有Git服务器:Soft Serve实战
运维·服务器·git
梅塔文·欧帕西安卡琼1 天前
git的底层原理详解
git
待什么青丝1 天前
【git的摸鱼技巧】之工欲善其事
git·elasticsearch·搜索引擎
2601_961194021 天前
高中英语教资资料推荐|科三大题背诵和教学设计模板
git·开源·github·开源软件·开源协议·ossinsight
ting94520001 天前
InsForge Backend Branching 后端全链路 Git 式分支技术原理、架构实现与底层源码剖析
人工智能·git·elasticsearch·架构
程序猿阿伟1 天前
《扣子如何让OpenClaw技能开发提速》
人工智能·git·github