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)

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

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

相关推荐
xxwl5851 小时前
Git 完整学习笔记:从入门到团队协作
笔记·git·学习
John_ToDebug4 小时前
Git 工作区、暂存区、仓库、远端同步完全指南:从 restore、reset 到 fetch、pull 的正确使用姿势
git·源代码管理
炸膛坦客16 小时前
Git 和 GitHub:(九)修改本地仓库内容并推送到远程仓库(关联/克隆)
git·github
To_OC18 小时前
一次 git reset 翻车,让我彻底分清了 hard 和 soft,也想通了 Vibe Coding 的本质
git·程序员·vibecoding
Ai拆代码的曹操18 小时前
Git 集成:AI 代理中的版本控制工作流设计
大数据·git·elasticsearch
lazy H19 小时前
Git clone 怎么用?克隆项目及常见问题完整教程
大数据·git·后端·学习·搜索引擎·github
m0_7436975921 小时前
关于ftp与SELinux的冲突问题
git·github
前进的程序员1 天前
VS Code Git 工作树:多分支并行开发体验
git·vs code·git工作树
半夜修仙1 天前
二.Git分支管理
git
六bring个六1 天前
git使用笔记
笔记·git