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)

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

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

相关推荐
SHIPKING39326 分钟前
【git命令操作指南】
git
LT_10291 小时前
如何初始化一个本地的项目到远程git仓库?
git·源代码管理
小付爱coding2 小时前
Claude Code安装教程【windows版本】
java·git·python
BIBI20492 小时前
Windows 下 Git 常规操作教程:命令行与 TortoiseGit
windows·git·tortoisegit·配置·版本控制·入门指南
The Straggling Crow5 小时前
熟练版本控制 (Git)、CI/CD 流程。
git·elasticsearch·ci/cd
海绵宝宝_8 小时前
Copilot 一键生成中文 Git Commit Message
git
孫治AllenSun8 小时前
【Git】分支管理
git
甲虫机8 小时前
git 常用命令
git
安果移不动8 小时前
【Git实战】记录一次分支切换失败的排查:Submodule 脏状态与强制切换
git
痕忆丶9 小时前
git 软重置的使用场景git reset --soft HEAD~1
git