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)

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

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

相关推荐
谷哥的小弟17 分钟前
(最新版)Git&GitHub实操图文详解教程(03)—Git工作原理
git·github·版本控制·工作原理·git工作原理
devilnumber1 小时前
idea中git的commit弹出框改为工具框
git
向日的葵0063 小时前
大模型技术之git(第四章)
git
火车叼位3 小时前
当 Git Pull 把工作区搅成一锅粥:理解 Merge 与 Abort
git
向日的葵0064 小时前
大模型技术之git(第六章)
git
澈2077 小时前
Git入门指南:核心概念与实用操作
大数据·git·搜索引擎
Naisu Xu7 小时前
Mac上安装Homebrew、Git、Python等环境记录
git·python·macos·终端·brew
摸鱼仙人~8 小时前
Learn Git Branching:提交的技巧
git
say_fall8 小时前
Git完全入门指南-从概念到实战掌握版本控制的核心
linux·运维·服务器·git·学习
小陶来咯9 小时前
Git Cherry-Pick
git