{"thread":{"id":"21606","subject":"cherry-pick vs submodule, conflicts","startedAt":"2009-11-13T18:05:12Z","lastAt":"2009-11-13T18:05:12Z","messageCount":1,"participants":["Jeff Epler"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"127513","messageId":"20091113180512.GA29783@unpythonic.net","threadId":"21606","inReplyTo":null,"subject":"cherry-pick vs submodule, conflicts","fromName":"Jeff Epler","fromEmail":"jepler@unpythonic.net","sentAt":"2009-11-13T18:05:12Z","receivedAt":"2009-11-13T18:05:12Z","isPatch":false,"sender":{"key":"jepler@unpythonic.net","avatar":"https://avatars.githubusercontent.com/u/1517291?v=4"},"body":"A fellow git user of mine encountered an unexpected problem cherry-\npicking from one branch to another.  The conflict was 'added by us: sub'\nand I created a small program that leads to the same message.\n\n#!/bin/bash\n# This script demonstrates that it doesn't work to cherry-pick when some (not\n# even touched) path is a submodule in HEAD but a regular subdirectory in the\n# branch being picked from.\n#\n# Furthermore, when using 'git mergetool', the (desired?) action 'c'\n# gives the error \"fatal: unable to stat 'sub': No such file or directory\".\n#\n# The behavior is essentially the same on\n# git version 1.6.3.3\n# git version 1.6.5.rc1.49.ge970\n#\n# maybe this is related to\n# http://kerneltrap.org/mailarchive/git/2007/7/7/250935\n# but the case must be extended to cover submodules?\n\nset -e\nBASEDIR=$(pwd)\nrm -rf main sub &&\nmkdir sub main &&\n(cd sub && git init && touch y && git add y && git commit -my) &&\n                                        # make a submodule\ncd ../main &&\ngit init &&\ntouch x; git add x &&\ngit commit -mx &&                       # initial commit\ngit branch b &&\nmkdir sub &&                            # on master, make sub a subdir\ntouch sub/y; git add sub/y &&\ngit commit -my &&\necho 1 > x &&\ngit commit -mx1 -a &&                   # and create a second commit\nCHERRY=$(git rev-parse HEAD) &&         # which is a tasty cherry\ngit checkout b &&\ngit submodule add file://$BASEDIR/sub sub &&\ngit submodule update &&\ngit commit -my &&                       # on brach, make sub a submodule\n! git cherry-pick $CHERRY &&            # pull second commit from master\ngit status                              # what happened?\n"}]}