{"thread":{"id":"34255","subject":"git subtree pull incorrectly reports merge conflict","startedAt":"2013-06-22T23:59:59Z","lastAt":"2013-06-22T23:59:59Z","messageCount":1,"participants":["Eric Lindsey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"221700","messageId":"CANFFsAZ-Q--3Kx_rYgkALd=nvo6r24sNpNQeHQdALYHhDwBxPQ@mail.gmail.com","threadId":"34255","inReplyTo":null,"subject":"git subtree pull incorrectly reports merge conflict","fromName":"Eric Lindsey","fromEmail":"elindsey@ucsd.edu","sentAt":"2013-06-22T23:59:59Z","receivedAt":"2013-06-22T23:59:59Z","isPatch":false,"sender":{"key":"elindsey@ucsd.edu","avatar":null},"body":"I'm having trouble pulling changes from a repo that was imported as a\nsubtree with 'git subtree add'. The issue occurs when I have\npreviously used 'git subtree push' from within the project directory,\nthen pushed changes to the remote repo again from somewhere else (from\nanother project also using it as a subtree, or directly with 'git\npush' -- doesn't matter). When I go back to the initial project, 'git\nsubtree pull' has a merge conflict, and fails to merge the new\nchanges. The reported conflict is half-empty, so I can't see why there\nis any conflict at all.\n\nI've found an odd workaround, where calling \"subtree pull\" immediately\nafter the \"subtree push\" from the project directory seems to keep\nthings in sync and prevent the later conflict (see the script below).\nI'm stumped as to why running a pull should find any changes right\nafter a push, but this is what happens. So it seems like a bug, unless\nI'm missing a critical step somewhere -- I'm fairly new to git still.\n\nI've pasted a script below that reproduces the problem in a simple\ncase, for my version of git (1.8.3.1, installed via homebrew on OS X\n10.8.4).\n\nThanks,\nEric\n\n\n#start from scratch\nrm -rf foo bar foo.git\n\n# create remote repo. for foo (bare)\nmkdir foo.git\ncd foo.git\ngit init --bare\ncd ..\n\n#create library foo and push to remote repo\nmkdir foo\ncd foo\necho \"this is a test file\" > test.foo\ngit init\ngit add .\ngit commit -m \"initial commit to foo\"\ngit remote add origin ../foo.git\ngit push origin master\ncd ..\n\n#create a project that uses foo as subtree\nmkdir bar\ncd bar\ngit init\necho \"test\" > test.bar\ngit add .\ngit commit -m \"initial commit to bar\"\ngit subtree add --prefix=foo ../foo.git master\necho \"modify foo from bar\" >> foo/test.foo\ngit add foo/test.foo\ngit commit -m \"update foo from bar\"\ngit subtree push --prefix=foo ../foo.git master\n### if I uncomment the next line, final 'subtree pull' doesn't fail... why?\n#git subtree pull --prefix=foo ../foo.git master -m \"pull right after push\"\ncd ..\n\n#now update foo from elsewhere\ncd foo\ngit pull origin master\necho \"modify foo from foo\" >> test.foo\ngit add test.foo\ngit commit -m \"update foo again\"\ngit push origin master\ncd ..\n\n# try to pull update from project bar\ncd bar\ngit subtree pull --prefix=foo ../foo.git master -m \"pull foo\"\n\n#above command fails to merge, and the reported conflict is half-empty.\n#resulting contents of bar/foo/test.foo are:\n\n#this is a test file\n#modify foo from bar\n#<<<<<<< HEAD\n#=======\n#modify foo from foo\n#>>>>>>> f0a24eeb1614228a1368ae23112ff4923dcf557e\n"}]}