git/list[1] front-page[2] threads[3] people[4] search[5] about
 

cherry-pick vs submodule, conflicts

From
Jeff Epler <jepler@unpythonic.net>
Date
Nov 13, 2009, 18:05 UTC
Message-ID
<20091113180512.GA29783@unpythonic.net>

A fellow git user of mine encountered an unexpected problem cherry- picking from one branch to another. The conflict was 'added by us: sub' and I created a small program that leads to the same message.

#!/bin/bash # This script demonstrates that it doesn't work to cherry-pick when some (not # even touched) path is a submodule in HEAD but a regular subdirectory in the # branch being picked from. # # Furthermore, when using 'git mergetool', the (desired?) action 'c' # gives the error "fatal: unable to stat 'sub': No such file or directory". # # The behavior is essentially the same on # git version 1.6.3.3 # git version 1.6.5.rc1.49.ge970 # # maybe this is related to # http://kerneltrap.org/mailarchive/git/2007/7/7/250935 # but the case must be extended to cover submodules?

set -e
BASEDIR=$(pwd)
rm -rf main sub &&
mkdir sub main &&
(cd sub && git init && touch y && git add y && git commit -my) &&
                                        # make a submodule
cd ../main &&
git init &&
touch x; git add x &&
git commit -mx &&                       # initial commit
git branch b &&
mkdir sub &&                            # on master, make sub a subdir
touch sub/y; git add sub/y &&
git commit -my &&
echo 1 > x &&
git commit -mx1 -a &&                   # and create a second commit
CHERRY=$(git rev-parse HEAD) &&         # which is a tasty cherry
git checkout b &&
git submodule add file://$BASEDIR/sub sub &&
git submodule update &&
git commit -my &&                       # on brach, make sub a submodule
! git cherry-pick $CHERRY &&            # pull second commit from master
git status                              # what happened?
Message 1 of 1 in “cherry-pick vs submodule, conflicts”
  1. Jeff EplerNov 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.