Whenever I use git cherry-pick
and there are conflicts, after resolving the conflicts and running git cherry-pick --continue
, the commit message has an added Conflicts:
section, like so:
<The original commit message>
Conflicts:
<path of first file that had a conflict>
...
<path of last file that had a conflict>
# The usual comment with instructions
The Conflicts:
section is not commented out, so if left unchanged, it becomes a part of the actual commit message of the cherry-picked commit.
So, two questions about this:
Why is this section useful at all? If I resolved the conflicts, why is the fact that they existed relevant?
Is there a way to disable this behaviour? I find it annoying to have to delete that section manually every time.
EDIT : Since a comment suggests that the behaviour may be dependent on the version of git: I'm using git 2.1.4, which is the version present in Debian stable's repositories.
For your questions:
It mainly caused there still have conflicts. You can use git status
to check. If there have conflicts, you should modify and save the conflict files, then use git add .
and git commit
. Also you can update git to latest version.
Yes, you can use -X
to solve the conflicts automatically. Such as git cherry-pick SHA -X [ours|theirs]
. ours
means to keep changes from current branch, theirs
means keep changes from the SHA.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.