{"thread":{"id":"38909","subject":"very weird behaviour with \"merge -s subtree\"","startedAt":"2015-03-25T12:55:23Z","lastAt":"2015-03-27T10:58:18Z","messageCount":3,"participants":["Kirill Marchuk"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"258501","messageId":"5512B03B.9020707@mail.ru","threadId":"38909","inReplyTo":null,"subject":"very weird behaviour with \"merge -s subtree\"","fromName":"Kirill Marchuk","fromEmail":"62mkv@mail.ru","sentAt":"2015-03-25T12:55:23Z","receivedAt":"2015-03-25T12:55:23Z","isPatch":false,"sender":{"key":"62mkv@mail.ru","avatar":null},"body":"Hi everyone\n\n  I'm totally stuck with a following problem:\n\n- we have a repo, which contains several projects as folders - like \n\"api\", \"adminUI\", \"android\", \"web\" - etc. Some parts are backend, some \nfrontend. Lets name these parts \"details\", as they constitute details of \nthe project in general.\n- we would like to deploy via git, so as to minimize effort on \ndeployment (and automate it later).\n- but every project is deployed separately.\n\n From all I've read so far, I came to conclusion that \"merge -s subtree\" \nseems to be done with this thing in mind, although scenarios,\ndescribed in articles like this one \n(https://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html) \nusually take only one part of it: merge from \"detail\" to \"common\", and \nnot vice versa.\n\nSo, what am I trying to: to implement a stable workflow, that would \nallow me to easily merge changes from \"develop\" in \"common\" repo to a \n\"subtree-branch\" and push to a corresponding \"detail\" remote.\n\nWhat I am doing:\n\n1) say, we have a folder \"adminUI\" in the root of \"common\" repo, branch \n\"test\" (it's a snapshot branch for test environment - all deploys should \nstart here)\n2) git remote add adminui-origin <path>\n3) git fetch adminui-origin\n4)  git checkout -B test-adminui adminui-origin/test\n(above steps are taken from \nhttp://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging)\n5) git checkout test\n6) git merge -s ours --no-commit test-adminui\n(this one is from \nhttps://www.kernel.org/pub/software/scm/git/docs/howto/using-merge-subtree.html)\n7) git read-tree --prefix=adminUI/ -u test-adminui\nHere I always get error like:\nerror: Entry 'adminUI/.gitignore' overlaps with 'adminUI/.gitignore'.  \nCannot bind.\n\n8) so, I have to rename folder \"adminUI\" to, like, \"adminUI2\", then \"git \ncommit -a\", then step 7 again\n9) ok, so now I have a whole content of \"adminui-origin\" in folder \n\"/adminUI\" in branch \"test\" of my \"common\" repo.\n10) then I merge changes from \"develop\", which I want to deploy: git \nmerge develop\n11) then I want to merge those changes \"down the line\" into \"detail\" repo:\ngit checkout test-adminui\ngit merge -s subtree test\n12) for the first time, everything seems fine - only relevant changes \n(i.e., changes in adminUI folder) are merged, and they go straight into \ntheir right places (i.e., with respect to folder structure difference \nbetween \"common\" and \"detail\")\n13) git push adminui-origin test-adminui:test  - this works good\n14) let's say something else was updated in develop:\ngit checkout test\ngit merge develop\ngit checkout test-adminui\n15) AND HERE BEGINS THE HELL:\ngit merge -s subtree test => leads to ALL of my working directory being \ncopied to a 3rd level folder somewhere in the adminUI depths !!!\n\nThis drives me TOTALLY insane, and I very much need help !!\n\nI use msysgit 1.9.4 on Windows 8.1\n\nI suspect that it might have to do with the repository structure, maybe \nsome errors, etc..\n\nBut I believe that it might be due to my total misunderstanding of something\n\nAnyway, I totally appreciate your help !\n\nThanks a lot\n\nKirill, frustrated unexperienced git user...\n"},{"id":"258543","messageId":"loom.20150326T115519-901@post.gmane.org","threadId":"38909","inReplyTo":"5512B03B.9020707@mail.ru","subject":"Re: very weird behaviour with","fromName":"Kirill Marchuk","fromEmail":"62mkv@mail.ru","sentAt":"2015-03-26T11:08:20Z","receivedAt":"2015-03-26T11:08:20Z","isPatch":false,"sender":{"key":"62mkv@mail.ru","avatar":null},"body":"Kirill Marchuk <62mkv <at> mail.ru> writes:\n\n> \n> Hi everyone\n> \n>   I'm totally stuck with a following problem:\n(censor cut)\n...........\n> \n> But I believe that it might be due to my total misunderstanding of something\n> \n> Anyway, I totally appreciate your help !\n> \n> Thanks a lot\n> \n> Kirill, frustrated unexperienced git user...\n> \n> \n\nHi Again\n\nWith \"git subtree\" today I have had even worse experience: \n\n1) git checkout test\n2) git branch test-tmp\n3) mv adminUI adminUI2 (because otherwise errors..)\n4) git commit -a -m \"Renamed adminUI\" \n5) git subtree add --prefix=adminUI adminui-origin/test --squash\n6) mv adminUI adminUI2 (because I don't want here the \"deploy\" versions)\n7) git commit -a -m \"Added adminui as subtree\"\n8) git merge develop (!!!!!! it went smoothly, but... see below)\n9) git checkout adminui-test\n10) git subtree merge --prefix=adminUI test-tmp\n11) git push adminui-origin test-adminui:test\n(instead of 9-11 I've tried to use \"git subtree push\", it's basically the\nsame, I believe, only takes FAR more time to complete)\n\nI was very glad and happy. Unless I've realized that, in fact, step 7 did\nnot proceed as it was intended to (by me, at least)\n\nIt has 2 parents, and 2 diffs, and one of them shows exactly what it has to\nshow (i.e. diff between tips of \"develop\" and \"test-tmp\"), but the files on\nthe commit snapshot were left unchanged (I cannot imagine how could that\nhappen, but that did)\n\nIf I modify files and commit them RIGHT INTO test-tmp branch, all the rest\ngoes fine (so far), but that unability to merge from \"develop\" is something\nthat's killing the whole point of it :(( \n\nI believe I am not the only one on this mailing list, so pleeease... \n\nKirill\n"},{"id":"258588","messageId":"loom.20150327T115302-412@post.gmane.org","threadId":"38909","inReplyTo":"loom.20150326T115519-901@post.gmane.org","subject":"Re: very weird behaviour with","fromName":"Kirill Marchuk","fromEmail":"62mkv@mail.ru","sentAt":"2015-03-27T10:58:18Z","receivedAt":"2015-03-27T10:58:18Z","isPatch":false,"sender":{"key":"62mkv@mail.ru","avatar":null},"body":"Kirill Marchuk <62mkv <at> mail.ru> writes:\n\n> \n> Kirill Marchuk <62mkv <at> mail.ru> writes:\n> \n> > \n> > Hi everyone\n> > \n> >   I'm totally stuck with a following problem:\n> (censor cut)\n> ...........\n> > \n> > But I believe that it might be due to my total misunderstanding of something\n> > \n> > Anyway, I totally appreciate your help !\n> > \n> > Thanks a lot\n> > \n> > Kirill, frustrated unexperienced git user...\n> > \n> > \n> \n> Hi Again\n> \n> With \"git subtree\" today I have had even worse experience: \n> \n> 1) git checkout test\n> 2) git branch test-tmp\n> 3) mv adminUI adminUI2 (because otherwise errors..)\n> 4) git commit -a -m \"Renamed adminUI\" \n> 5) git subtree add --prefix=adminUI adminui-origin/test --squash\n> 6) mv adminUI adminUI2 (because I don't want here the \"deploy\" versions)\n> 7) git commit -a -m \"Added adminui as subtree\"\n> 8) git merge develop (!!!!!! it went smoothly, but... see below)\n> 9) git checkout adminui-test\n> 10) git subtree merge --prefix=adminUI test-tmp\n> 11) git push adminui-origin test-adminui:test\n> (instead of 9-11 I've tried to use \"git subtree push\", it's basically the\n> same, I believe, only takes FAR more time to complete)\n> \n> I was very glad and happy. Unless I've realized that, in fact, step 7 did\n> not proceed as it was intended to (by me, at least)\n> \n> It has 2 parents, and 2 diffs, and one of them shows exactly what it has to\n> show (i.e. diff between tips of \"develop\" and \"test-tmp\"), but the files on\n> the commit snapshot were left unchanged (I cannot imagine how could that\n> happen, but that did)\n> \n> If I modify files and commit them RIGHT INTO test-tmp branch, all the rest\n> goes fine (so far), but that unability to merge from \"develop\" is something\n> that's killing the whole point of it :(( \n> \n> I believe I am not the only one on this mailing list, so pleeease... \n> \n> Kirill\n> \n> \n\n\nEven more mysterious thing happens today...\nwhen I do \ngit checkout test-adminui\ngit subtree merge --prefix=adminUI test-tmp\n\nI receive \n'adminUI' does not exist; use 'git subtree add'\n\nall the difference I can possibly think of, is that it probably requires me\nto create \"subtree\" after every push ?? \nor is it due to my checkout-s and pulls into other branches during the day ? \n\nNo ideas\n\nAny help is greatly appreciated.. Although I am starting to think that I\nprobably chose wrong channel to seek for help on this case... \n\nThanks for any reaction.\n\nKirill\n"}]}