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)

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

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

相关推荐
蓝黑墨水5 分钟前
一个git问题的处理
git
互联网中的一颗神经元3 小时前
21 — 额外命令:同时开两个窗口、自动检查哨
git
_道隐_6 小时前
git stash save 和 git stash push有什么区别?
git
_道隐_8 小时前
git stash如何pop指定的stash change?
git
PC2005-cloud10 小时前
Git学习笔记:GitHub Git Data API 完全指南,用 Go 操控 Git 底层对象
笔记·git·学习
Python私教1 天前
AI 并行编码的 Worktree 生命周期:创建、隔离与安全回收
人工智能·git
互联网中的一颗神经元1 天前
16 — 改写历史 rebase:搬家到新楼层,不是合并
git
互联网中的一颗神经元1 天前
19 — 贮藏与清理:stash 是抽屉,gc 是打包箱
git
用户330144867631 天前
20 — 远程进阶:强制推送的保险绳——force-with-lease
git
Cooper251 天前
别急着改 Git 历史:rebase、cherry-pick、bisect 与 reflog 的安全操作顺序
git