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)

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

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

相关推荐
大志哥12324 分钟前
idea+git插件+云备份实现项目新分支新建维护
git
恋喵大鲤鱼43 分钟前
git merge
git·git merge
码客日记1 小时前
Spring Boot 配置文件敏感信息加密(Jasypt 企业级完整方案)
java·spring boot·git
_codemonster2 小时前
Codex 核心进阶玩法(技能/MCP/派生/分叉/Git/钩子/子智能体)
git
逻极2 小时前
Git 从入门到精通:版本控制协作实战指南
git·github·分支管理·版本控制
恋喵大鲤鱼2 小时前
git clean
git·git clean
Patrick_Wilson2 小时前
为省一次回归测试,该不该把多个改动堆进一条分支?
git·ci/cd·架构
恋喵大鲤鱼3 小时前
git blame
git·git blame
yeflx3 小时前
Git操作
git
恋喵大鲤鱼3 小时前
git pull
git·git pull