{"thread":{"id":"13169","subject":"Re: Q. regarding subtree merge","startedAt":"2008-04-18T09:36:30Z","lastAt":"2008-04-18T12:59:57Z","messageCount":5,"participants":["Santi Béjar","Stefan Näwe"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"74715","messageId":"loom.20080418T091729-407@post.gmane.org","threadId":"13169","inReplyTo":null,"subject":"Q. regarding subtree merge","fromName":"Stefan Näwe","fromEmail":"stefan.naewe+git@gmail.com","sentAt":"2008-04-18T09:36:30Z","receivedAt":"2008-04-18T09:36:30Z","isPatch":false,"sender":{"key":"stefan.naewe+git@gmail.com","avatar":"https://gravatar.com/avatar/ff9c89e7b42e5c7f494ef0f19ac9bde6693fb6465356711b8d4ed47d2108dd46?d=mp&s=160"},"body":"Hi all.\n\nI tried the scenario described in \n$GIT_DIR/Documentation/howto/using-merge-subtree.txt and have some problems \nwith it.\n\nMy setup:\n\nI use git to track my changes in three different \"project directories\", lets\nsay:\n\n...../src_root/libfoo\n...../src_root/appbar\n...../bin_root/installed\n\nAll three git repositories contain a topic branch (lets say 'current-work')\nthat I want to track. \n\nNow I want to setup one git repository containing only the three directories\n'libfoo', 'appbar', and 'installed' that others can clone easily. Reading the\nabove howto document, I think this should be possible. \n\nI do:\n\n  $ mkdir super-prj \n  $ cd super-prj \n  $ git init\n  $ git add remote -f libfoo ../path/to/src_root/libfoo\n\nOK. No problem. \n\nThe problem arises after the second step of the howto:\n\n  $ git merge -s ours --no-commit libfoo/current-work\n\nNow, all files of 'libfoo' are in the current directory. This is not what I \nwant.\n\nCould someone please tell me what I'm doing wrong?\n\nThanks\n\nStefan\n"},{"id":"74712","messageId":"8aa486160804180302m43a7c942la93954401741b264@mail.gmail.com","threadId":"13169","inReplyTo":"loom.20080418T091729-407@post.gmane.org","subject":"Re: Q. regarding subtree merge","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-04-18T10:02:58Z","receivedAt":"2008-04-18T10:02:58Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, Apr 18, 2008 at 11:36 AM, Stefan Näwe\n<stefan.naewe+git@gmail.com> wrote:\n> Hi all.\n>\n>  I tried the scenario described in\n>  $GIT_DIR/Documentation/howto/using-merge-subtree.txt and have some problems\n>  with it.\n>\n>  My setup:\n>\n>  I use git to track my changes in three different \"project directories\", lets\n>  say:\n>\n>  ...../src_root/libfoo\n>  ...../src_root/appbar\n>  ...../bin_root/installed\n>\n>  All three git repositories contain a topic branch (lets say 'current-work')\n>  that I want to track.\n>\n>  Now I want to setup one git repository containing only the three directories\n>  'libfoo', 'appbar', and 'installed' that others can clone easily. Reading the\n>  above howto document, I think this should be possible.\n>\n>  I do:\n>\n>   $ mkdir super-prj\n>   $ cd super-prj\n>   $ git init\n>   $ git add remote -f libfoo ../path/to/src_root/libfoo\n>\n>  OK. No problem.\n>\n>  The problem arises after the second step of the howto:\n>\n>   $ git merge -s ours --no-commit libfoo/current-work\n>\n>  Now, all files of 'libfoo' are in the current directory. This is not what I\n>  want.\n>\n>  Could someone please tell me what I'm doing wrong?\n\nYou are trying to merge libfoo with an empty project, so the merge\njust \"fast-forward\" to the other commit as you do not have an \"ours\".\n\nSimply skip the merge step.\n\nSanti\n"},{"id":"74711","messageId":"8aa486160804180309o26ab9c69j2b3b665a280bf7c4@mail.gmail.com","threadId":"13169","inReplyTo":"8aa486160804180302m43a7c942la93954401741b264@mail.gmail.com","subject":"Re: Q. regarding subtree merge","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-04-18T10:09:54Z","receivedAt":"2008-04-18T10:09:54Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, Apr 18, 2008 at 12:02 PM, Santi Béjar <sbejar@gmail.com> wrote:\n>\n> On Fri, Apr 18, 2008 at 11:36 AM, Stefan Näwe\n>  <stefan.naewe+git@gmail.com> wrote:\n>  > Hi all.\n>  >\n>  >  I tried the scenario described in\n>  >  $GIT_DIR/Documentation/howto/using-merge-subtree.txt and have some problems\n>  >  with it.\n>  >\n>  >  My setup:\n>  >\n>  >  I use git to track my changes in three different \"project directories\", lets\n>  >  say:\n>  >\n>  >  ...../src_root/libfoo\n>  >  ...../src_root/appbar\n>  >  ...../bin_root/installed\n>  >\n>  >  All three git repositories contain a topic branch (lets say 'current-work')\n>  >  that I want to track.\n>  >\n>  >  Now I want to setup one git repository containing only the three directories\n>  >  'libfoo', 'appbar', and 'installed' that others can clone easily. Reading the\n>  >  above howto document, I think this should be possible.\n>  >\n>  >  I do:\n>  >\n>  >   $ mkdir super-prj\n>  >   $ cd super-prj\n>  >   $ git init\n>  >   $ git add remote -f libfoo ../path/to/src_root/libfoo\n>  >\n>  >  OK. No problem.\n>  >\n>  >  The problem arises after the second step of the howto:\n>  >\n>  >   $ git merge -s ours --no-commit libfoo/current-work\n>  >\n>  >  Now, all files of 'libfoo' are in the current directory. This is not what I\n>  >  want.\n>  >\n>  >  Could someone please tell me what I'm doing wrong?\n>\n>  You are trying to merge libfoo with an empty project, so the merge\n>  just \"fast-forward\" to the other commit as you do not have an \"ours\".\n>\n>  Simply skip the merge step.\n\nUps, I think you have to specify the parent for the new commit. Maybe\nchange the merge step with:\n\n$ git reset --soft libfoo/current-work\n\nSanti\n"},{"id":"74735","messageId":"60b759020804180518k2fc1957bk60a5d7cdac8c3991@mail.gmail.com","threadId":"13169","inReplyTo":"8aa486160804180309o26ab9c69j2b3b665a280bf7c4@mail.gmail.com","subject":"Re: Q. regarding subtree merge","fromName":"Stefan Näwe","fromEmail":"stefan.naewe@googlemail.com","sentAt":"2008-04-18T12:18:25Z","receivedAt":"2008-04-18T12:18:25Z","isPatch":false,"sender":{"key":"stefan.naewe@gmail.com","avatar":"https://avatars.githubusercontent.com/u/4468?v=4"},"body":"2008/4/18, Santi Béjar <sbejar@gmail.com>:\n> On Fri, Apr 18, 2008 at 12:02 PM, Santi Béjar <sbejar@gmail.com> wrote:\n>  >\n>  > On Fri, Apr 18, 2008 at 11:36 AM, Stefan Näwe\n>  >  <stefan.naewe+git@gmail.com> wrote:\n>  >  > Hi all.\n>  >  >\n>  >  >  I tried the scenario described in\n>  >  >  $GIT_DIR/Documentation/howto/using-merge-subtree.txt and have some problems\n>  >  >  with it.\n>  >  >\n>  >  >  My setup:\n>  >  >\n>  >  >  I use git to track my changes in three different \"project directories\", lets\n>  >  >  say:\n>  >  >\n>  >  >  ...../src_root/libfoo\n>  >  >  ...../src_root/appbar\n>  >  >  ...../bin_root/installed\n>  >  >\n>  >  >  All three git repositories contain a topic branch (lets say 'current-work')\n>  >  >  that I want to track.\n>  >  >\n>  >  >  Now I want to setup one git repository containing only the three directories\n>  >  >  'libfoo', 'appbar', and 'installed' that others can clone easily. Reading the\n>  >  >  above howto document, I think this should be possible.\n>  >  >\n>  >  >  I do:\n>  >  >\n>  >  >   $ mkdir super-prj\n>  >  >   $ cd super-prj\n>  >  >   $ git init\n>  >  >   $ git add remote -f libfoo ../path/to/src_root/libfoo\n>  >  >\n>  >  >  OK. No problem.\n>  >  >\n>  >  >  The problem arises after the second step of the howto:\n>  >  >\n>  >  >   $ git merge -s ours --no-commit libfoo/current-work\n>  >  >\n>  >  >  Now, all files of 'libfoo' are in the current directory. This is not what I\n>  >  >  want.\n>  >  >\n>  >  >  Could someone please tell me what I'm doing wrong?\n>  >\n>  >  You are trying to merge libfoo with an empty project, so the merge\n>  >  just \"fast-forward\" to the other commit as you do not have an \"ours\".\n>  >\n>  >  Simply skip the merge step.\n>\n>\n> Ups, I think you have to specify the parent for the new commit. Maybe\n>  change the merge step with:\n>\n>  $ git reset --soft libfoo/current-work\n>\n\nOK. Thanks. It worked without the merge.\nI did another test where the 'super-prj' was not empty, this time with\n'git merge -s...' and\nthat worked as well. So:\nIf you have an empty super-prj    -> drop the merge\nIf you have a non-empty super-prj -> do the merge\n\nBut I really don't understand (yet...) why it is as it is...\n\nThanks\n\nStefan\n"},{"id":"74734","messageId":"8aa486160804180559y70c72449g8f0beff63c229c7b@mail.gmail.com","threadId":"13169","inReplyTo":"60b759020804180518k2fc1957bk60a5d7cdac8c3991@mail.gmail.com","subject":"Re: Q. regarding subtree merge","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2008-04-18T12:59:57Z","receivedAt":"2008-04-18T12:59:57Z","isPatch":false,"sender":{"key":"santi@agolina.net","avatar":null},"body":"On Fri, Apr 18, 2008 at 2:18 PM, Stefan Näwe\n<stefan.naewe@googlemail.com> wrote:\n> 2008/4/18, Santi Béjar <sbejar@gmail.com>:\n>\n[...]\n\n>  >\n>  >  $ git reset --soft libfoo/current-work\n>  >\n>\n>  OK. Thanks. It worked without the merge.\n>  I did another test where the 'super-prj' was not empty, this time with\n>  'git merge -s...' and\n>  that worked as well. So:\n>  If you have an empty super-prj    -> drop the merge\n\n+ git reset --soft commit\n\nIf not the next \"git merge -s subtree\" will fail.\n\n>  If you have a non-empty super-prj -> do the merge\n>\n>  But I really don't understand (yet...) why it is as it is...\n\nBecause you cannot merge an empty branch with another branch.\nMaybe \"git merge -s ours\" should fail in this case, because it does not\nmake sense to merge an empty branch with the \"ours\" strategy.\n\nSanti\n"}]}