3ad1444d^ .. 73e10933 为远程分支新提交,ac-dev分支落后远程分支4bd1444d^ .. 83e10922个提交。现对ac-dev分支进行了修改,打算将ac-dev分支同步到4bd1444d最新提交,并保留ac-dev分支落后时的修改;
ac-dev落后修改后没有提交或将其隐藏,直接cherry-pick遇到以下错误。
git cherry-pick 3ad1444d^ .. 73e10933
error: Your local changes to the following files would be overwritten by merge:
Config/AcProject/CMakeLists.txt
AcProject/AcPhotoSnap.cpp
Compiler.sh
Please commit your changes or stash them before you merge.
Aborting
fatal: cherry-pick failed
这个错误通常发生在尝试合并(merge)时出现,说明有冲突。对此,git 给出了提示 : 请在合并之前提交更改或将其隐藏。
处理方法:
1. git stash save "ac-dev imu"
2. git checkout master
3. git pull
4. git checkout ac-dev
5. git cherry-pick 3ad1444d^ .. 73e10933
6. git stash pop
Auto-merging Compiler.sh
Auto-merging AcProject/AcPhotoSnap.cpp
CONFLICT (content): Merge conflict in AcProject/AcPhotoSnap.cpp
Auto-merging Config/AcProject/CMakeLists.txt
CONFLICT (content): Merge conflict in Config/AcProject/CMakeLists.txt
The stash entry is kept in case you need it again. (藏匿条目会保留下来,以防您再次需要。)
7. git status
On branch ac-dev
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: AcProject/AcPhotoSnap.h
Unmerged paths:
(use "git restore --staged <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: Config/AcProject/CMakeLists.txt
both modified: AcProject/AcPhotoSnap.cpp
8. 依照 git 提示解决冲突即可。
标签:files,overwritten,ac,git,cherry,dev,AcPhotoSnap,AcProject From: https://blog.csdn.net/xiaozhiwise/article/details/142386149