ILD

cherry-pick发生冲突时,HEAD,index和working tree的状态
作者:Yuan Jianpeng 邮箱:yuanjp89@163.com
发布时间:2020-11-9 站点:Inside Linux Development

当有冲突而不能完成整个cherry pick时:



冲突的文件 git status显示均为Unmerged path:

$ git st

On branch master

You are currently cherry-picking commit ddfcee4.

  (fix conflicts and run "git cherry-pick --continue")

  (use "git cherry-pick --abort" to cancel the cherry-pick operation)


Unmerged paths:

  (use "git add <file>..." to mark resolution)


        both modified:   c


git diff显示的是冲突部分的内容:

$ git diff .

diff --cc c

index bc645ae,80fd1c5..0000000

--- a/c

+++ b/c

@@@ -2,7 -2,7 +2,11 @@@ c0

  unchagned

  unchagned

  unchagned

++<<<<<<< HEAD

 +c11

++=======

+ c12

++>>>>>>> ddfcee4... test changed

  unchagned

  unchagned

  unchagned


ls-files显示c的个文件,stage分别为1,2,3

$ git ls-files -u

100644 19f0f44f7b31f79b3fc29e264beb4d5fb94752bd 1       c

100644 bc645ae15b8eb588d3024ce0d2d3231b0383d69f 2       c

100644 80fd1c5b6663ff5746855ecd4af3ea665a041d43 3       c


参考:

https://git-scm.com/docs/git-cherry-pick

https://git-scm.com/docs/git-merge

https://git-scm.com/docs/git-ls-files

https://git-scm.com/docs/git-read-tree

Copyright © linuxdev.cc 2017-2024. Some Rights Reserved.