{"thread":{"id":"25219","subject":"Multiple checkouts active for the same repository","startedAt":"2010-09-24T09:29:47Z","lastAt":"2010-09-27T11:53:53Z","messageCount":9,"participants":["Gustavo Narea","Ævar Arnfjörð Bjarmason","Julian Phillips","Jakub Narebski","Joshua Jensen","Martin Pettersson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"151455","messageId":"4C9C6F8B.3090806@tech.2degreesnetwork.com","threadId":"25219","inReplyTo":null,"subject":"Multiple checkouts active for the same repository","fromName":"Gustavo Narea","fromEmail":"gnarea@tech.2degreesnetwork.com","sentAt":"2010-09-24T09:29:47Z","receivedAt":"2010-09-24T09:29:47Z","isPatch":false,"sender":{"key":"gnarea@tech.2degreesnetwork.com","avatar":null},"body":"Hello.\n\nWe're currently migrating from another DVCS, which allows us to have\nworking copies of each branch in separate directories, so that their\ncode can be used simultaneously. However, I haven't found a way to do\nthis with Git, at least not an easy way. Can you please help me?\n\nWe are a team of Web developers and testers working on an application.\nThere are always a few development branches and a stable branch, and\ntesters need all the branches with the very latest code available at all\ntimes.\n\nThe way we handle it at the moment is very simple because the server\nhosting the remote repository is the same that hosts the deployed\ninstances of each branch, so when we push to the remote repository, the\ncode for each site is automatically updated.\n\nWe use the following structure:\n/srv/repositories/project/branch1\n/srv/repositories/project/branch2\n/srv/repositories/project/branch3\n\nIs there any simple way to do this with Git? I can only think of two\noptions that involve hooks:\n\n    * Have a hook that exports each branch to a directory like\n      /srv/repositories/project/branchN\n    * Have one Git repository per branch, so that each repository have a\n      different checkout active. Then the main remote repository will\n      have post-receive hooks that trigger a pull on each individual\n\nI'm not particularly happy with either way. Is there a better solution?\n\n-- \nGustavo Narea.\nSoftware Developer.\n2degrees, Ltd. <http://dev.2degreesnetwork.com/>.\n"},{"id":"151469","messageId":"4C9C919F.3040005@tech.2degreesnetwork.com","threadId":"25219","inReplyTo":"4C9C6F8B.3090806@tech.2degreesnetwork.com","subject":"Re: Multiple checkouts active for the same repository","fromName":"Gustavo Narea","fromEmail":"gnarea@tech.2degreesnetwork.com","sentAt":"2010-09-24T11:55:11Z","receivedAt":"2010-09-24T11:55:11Z","isPatch":false,"sender":{"key":"gnarea@tech.2degreesnetwork.com","avatar":null},"body":"I guess it all comes down to one thing: How can I avoid Git's feature of\nmaking only one branch/checkout active at a time under the same path?\n\nI need to have the branches and their checkouts on different\ndirectories, and it seems like the only way to do it is having one\nrepository per branch/checkout, which doesn't look like the ideal way of\ndoing things in Git.\n\nApart from the situation I describe in the initial email, there's\nanother limitation in the development environment: Our IDE, Eclipse +\nPydev, assumes each project (i.e., branch/checkout) to be on different\ndirectories and each project should have different settings (e.g., paths\nto dependencies, which could be different), but with GIt everything\nwould be a single project because it's all on the same path.\n\nThanks in advance.\n\n - Gustavo.\n\nOn 24/09/10 10:29, Gustavo Narea wrote:\n> Hello.\n> \n> We're currently migrating from another DVCS, which allows us to have\n> working copies of each branch in separate directories, so that their\n> code can be used simultaneously. However, I haven't found a way to do\n> this with Git, at least not an easy way. Can you please help me?\n> \n> We are a team of Web developers and testers working on an application.\n> There are always a few development branches and a stable branch, and\n> testers need all the branches with the very latest code available at all\n> times.\n> \n> The way we handle it at the moment is very simple because the server\n> hosting the remote repository is the same that hosts the deployed\n> instances of each branch, so when we push to the remote repository, the\n> code for each site is automatically updated.\n> \n> We use the following structure:\n> /srv/repositories/project/branch1\n> /srv/repositories/project/branch2\n> /srv/repositories/project/branch3\n> \n> Is there any simple way to do this with Git? I can only think of two\n> options that involve hooks:\n> \n>     * Have a hook that exports each branch to a directory like\n>       /srv/repositories/project/branchN\n>     * Have one Git repository per branch, so that each repository have a\n>       different checkout active. Then the main remote repository will\n>       have post-receive hooks that trigger a pull on each individual\n> \n> I'm not particularly happy with either way. Is there a better solution?\n> \n\n\n-- \nGustavo Narea.\nSoftware Developer.\n2degrees, Ltd. <http://dev.2degreesnetwork.com/>.\n"},{"id":"151474","messageId":"AANLkTikvyM9wXrewRiG7OdBp5LMfnHSkA9dqZGT1Twpc@mail.gmail.com","threadId":"25219","inReplyTo":"4C9C6F8B.3090806@tech.2degreesnetwork.com","subject":"Re: Multiple checkouts active for the same repository","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-09-24T13:07:27Z","receivedAt":"2010-09-24T13:07:27Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Fri, Sep 24, 2010 at 09:29, Gustavo Narea\n<gnarea@tech.2degreesnetwork.com> wrote:\n\n> We're currently migrating from another DVCS.\n\nWhich one?\n\n> We are a team of Web developers and testers working on an application.\n> There are always a few development branches and a stable branch, and\n> testers need all the branches with the very latest code available at all\n> times.\n>\n> The way we handle it at the moment is very simple because the server\n> hosting the remote repository is the same that hosts the deployed\n> instances of each branch, so when we push to the remote repository, the\n> code for each site is automatically updated.\n>\n> We use the following structure:\n> /srv/repositories/project/branch1\n> /srv/repositories/project/branch2\n> /srv/repositories/project/branch3\n>\n> Is there any simple way to do this with Git? I can only think of two\n> options that involve hooks:\n>\n>    * Have a hook that exports each branch to a directory like\n>      /srv/repositories/project/branchN\n>    * Have one Git repository per branch, so that each repository have a\n>      different checkout active. Then the main remote repository will\n>      have post-receive hooks that trigger a pull on each individual\n>\n> I'm not particularly happy with either way. Is there a better solution?\n\nIf you really need this the best solution is to just `git clone` the\nproject multiple times and check out each branch in its own dir. Then\nhave some shellscript to update them all.\n\nBut just using the Git workflow would be better.\n\n> Apart from the situation I describe in the initial email, there's\n> another limitation in the development environment: Our IDE, Eclipse +\n> Pydev, assumes each project (i.e., branch/checkout) to be on different\n> directories and each project should have different settings (e.g., paths\n> to dependencies, which could be different), but with GIt everything\n> would be a single project because it's all on the same path.\n\nCan't you just modify your build environment to check the output of\n`git symbolic-ref HEAD` or equivalent, instead of checking paths?\n"},{"id":"151485","messageId":"4C9CB8C6.1050101@tech.2degreesnetwork.com","threadId":"25219","inReplyTo":"AANLkTikvyM9wXrewRiG7OdBp5LMfnHSkA9dqZGT1Twpc@mail.gmail.com","subject":"Re: Multiple checkouts active for the same repository","fromName":"Gustavo Narea","fromEmail":"gnarea@tech.2degreesnetwork.com","sentAt":"2010-09-24T14:42:14Z","receivedAt":"2010-09-24T14:42:14Z","isPatch":false,"sender":{"key":"gnarea@tech.2degreesnetwork.com","avatar":null},"body":"Hello,\n\nOn 24/09/10 14:07, Ævar Arnfjörð Bjarmason wrote:\n> On Fri, Sep 24, 2010 at 09:29, Gustavo Narea\n> <gnarea@tech.2degreesnetwork.com> wrote:\n> \n>> We're currently migrating from another DVCS.\n> \n> Which one?\n\nBazaar.\n\n\n>> We are a team of Web developers and testers working on an application.\n>> There are always a few development branches and a stable branch, and\n>> testers need all the branches with the very latest code available at all\n>> times.\n>>\n>> The way we handle it at the moment is very simple because the server\n>> hosting the remote repository is the same that hosts the deployed\n>> instances of each branch, so when we push to the remote repository, the\n>> code for each site is automatically updated.\n>>\n>> We use the following structure:\n>> /srv/repositories/project/branch1\n>> /srv/repositories/project/branch2\n>> /srv/repositories/project/branch3\n>>\n>> Is there any simple way to do this with Git? I can only think of two\n>> options that involve hooks:\n>>\n>>    * Have a hook that exports each branch to a directory like\n>>      /srv/repositories/project/branchN\n>>    * Have one Git repository per branch, so that each repository have a\n>>      different checkout active. Then the main remote repository will\n>>      have post-receive hooks that trigger a pull on each individual\n>>\n>> I'm not particularly happy with either way. Is there a better solution?\n> \n> If you really need this the best solution is to just `git clone` the\n> project multiple times and check out each branch in its own dir. Then\n> have some shellscript to update them all.\n> \n> But just using the Git workflow would be better.\n\nOK, I'll do it that way.\n\n\n>> Apart from the situation I describe in the initial email, there's\n>> another limitation in the development environment: Our IDE, Eclipse +\n>> Pydev, assumes each project (i.e., branch/checkout) to be on different\n>> directories and each project should have different settings (e.g., paths\n>> to dependencies, which could be different), but with GIt everything\n>> would be a single project because it's all on the same path.\n> \n> Can't you just modify your build environment to check the output of\n> `git symbolic-ref HEAD` or equivalent, instead of checking paths?\n\nYes, that's what I intend to do for the build system, but that wouldn't\nsolve the problem with the IDE:\n\nEclipse and PyDev (Python plugin) store their settings in the project\ndirectory. For example, the one from PyDev contains the absolute paths\nto all the dependencies, which makes features like auto-completion work;\nI would have to mark these files are ignored because they change from\nmachine to machine, and sometimes from branch to branch.\n\nSo, no matter what the active branch is, I will always get the settings\nfor the first branch I configured. And if I change them, all the other\nbranches will be affected.\n\nAny suggestions?\n\nI tried playing with --git-dir and --work-tree, so that I could have the\nrepository in one place and the checkout for each branch on different\nrepositories, but it doesn't seem to be a good solution because we\ncannot specify the branch in commands like git-status.\n\nThank you very much.\n-- \nGustavo Narea.\nSoftware Developer.\n2degrees, Ltd. <http://dev.2degreesnetwork.com/>.\n"},{"id":"151489","messageId":"14b089955184bbb677b6434993682403@212.159.54.234","threadId":"25219","inReplyTo":"4C9C6F8B.3090806@tech.2degreesnetwork.com","subject":"Re: Multiple checkouts active for the same repository","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2010-09-24T15:33:13Z","receivedAt":"2010-09-24T15:33:13Z","isPatch":false,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"On Fri, 24 Sep 2010 10:29:47 +0100, Gustavo Narea\n<gnarea@tech.2degreesnetwork.com> wrote:\n> Hello.\n> \n> We're currently migrating from another DVCS, which allows us to have\n> working copies of each branch in separate directories, so that their\n> code can be used simultaneously. However, I haven't found a way to do\n> this with Git, at least not an easy way. Can you please help me?\n\nThe git-new-workdir script to be found in contrib/workdir allows multiple\nworking copies to share the same repository - though there are some\ncaveats:\n\n 1) uses symbolic links, so doesn't work on Windows\n 2) the working copies are not aware of each other, so if you change a\nchecked out branch from another working copy you have to remember to git\nreset your working copy before doing anything with it to get it back in\nsync with the branch\n 3) you have to remember not to delete the actual clone\n 4) the working copies are not aware of each other, so it is possible for\nobjects needed by one working copy to get pruned from another one\n\nPersonally, I use this script all the time to checkout multiple branches\nat the same time taking care to stay away from the issues above, and\neverything hums along nicely.\n\n> We are a team of Web developers and testers working on an application.\n> There are always a few development branches and a stable branch, and\n> testers need all the branches with the very latest code available at all\n> times.\n> \n> The way we handle it at the moment is very simple because the server\n> hosting the remote repository is the same that hosts the deployed\n> instances of each branch, so when we push to the remote repository, the\n> code for each site is automatically updated.\n> \n> We use the following structure:\n> /srv/repositories/project/branch1\n> /srv/repositories/project/branch2\n> /srv/repositories/project/branch3\n> \n> Is there any simple way to do this with Git? I can only think of two\n> options that involve hooks:\n> \n>     * Have a hook that exports each branch to a directory like\n>       /srv/repositories/project/branchN\n>     * Have one Git repository per branch, so that each repository have a\n>       different checkout active. Then the main remote repository will\n>       have post-receive hooks that trigger a pull on each individual\n> \n> I'm not particularly happy with either way. Is there a better solution?\n\n-- \nJulian\n"},{"id":"151490","messageId":"m3hbhfgmo4.fsf@localhost.localdomain","threadId":"25219","inReplyTo":"4C9C6F8B.3090806@tech.2degreesnetwork.com","subject":"Re: Multiple checkouts active for the same repository","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-09-24T15:57:37Z","receivedAt":"2010-09-24T15:57:37Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Gustavo Narea <gnarea@tech.2degreesnetwork.com> writes:\n\n> Hello.\n> \n> We're currently migrating from another DVCS, which allows us to have\n> working copies of each branch in separate directories, so that their\n> code can be used simultaneously. However, I haven't found a way to do\n> this with Git, at least not an easy way. Can you please help me?\n\nUse git-new-workdir script from contrib/workdir/ in git repository\nhttp://repo.or.cz/w/git.git/blob/HEAD:/contrib/workdir/git-new-workdir\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"151510","messageId":"4C9CD2B2.3030106@workspacewhiz.com","threadId":"25219","inReplyTo":"14b089955184bbb677b6434993682403@212.159.54.234","subject":"Re: Multiple checkouts active for the same repository","fromName":"Joshua Jensen","fromEmail":"jjensen@workspacewhiz.com","sentAt":"2010-09-24T16:32:50Z","receivedAt":"2010-09-24T16:32:50Z","isPatch":false,"sender":{"key":"jjensen@workspacewhiz.com","avatar":"https://avatars.githubusercontent.com/u/111687?v=4"},"body":"  ----- Original Message -----\nFrom: Julian Phillips\nDate: 9/24/2010 9:33 AM\n> The git-new-workdir script to be found in contrib/workdir allows multiple\n> working copies to share the same repository - though there are some\n> caveats:\n>\n>   1) uses symbolic links, so doesn't work on Windows\nWindows Vista and Windows 7 both support proper file and directory \nsymbolic links.  According to my experimentation the other day with \ngit-new-workdir on Windows 7:\n\n* Windows - mklink /D creates a directory symbolic link.  mklink creates \na file symbolic link.  The file system traverses into the symbolic link \nand back out of it just like Unix.  rmdir /S deletes just the directory \nsymbolic link.  Windows Explorer's delete does the same.\n* Cygwin - 'ln -s' does not create a true directory symbolic link.  \nCygwin seems to understand the symbolic link, but Windows itself \ndoesn't.  'rm -f' properly deletes a directory symbolic link.\n* Bash included with msysGit - 'ln -s' performs a file/directory copy.  \n'rm -f' whacks the directory contents of the linked directory and then \ndeletes the symbolic link.  Ick.  :(\n\nJosh\n"},{"id":"151811","messageId":"4CA072FC.3020004@tech.2degreesnetwork.com","threadId":"25219","inReplyTo":"14b089955184bbb677b6434993682403@212.159.54.234","subject":"Re: Multiple checkouts active for the same repository","fromName":"Gustavo Narea","fromEmail":"gnarea@tech.2degreesnetwork.com","sentAt":"2010-09-27T10:33:32Z","receivedAt":"2010-09-27T10:33:32Z","isPatch":false,"sender":{"key":"gnarea@tech.2degreesnetwork.com","avatar":null},"body":"Hello,\n\nThanks! I've given git-new-workdir a try and it seems to be what I was\nsearching for.\n\n - Gustavo.\n\nOn 24/09/10 16:33, Julian Phillips wrote:\n> On Fri, 24 Sep 2010 10:29:47 +0100, Gustavo Narea\n> <gnarea@tech.2degreesnetwork.com> wrote:\n>> Hello.\n>>\n>> We're currently migrating from another DVCS, which allows us to have\n>> working copies of each branch in separate directories, so that their\n>> code can be used simultaneously. However, I haven't found a way to do\n>> this with Git, at least not an easy way. Can you please help me?\n> \n> The git-new-workdir script to be found in contrib/workdir allows multiple\n> working copies to share the same repository - though there are some\n> caveats:\n> \n>  1) uses symbolic links, so doesn't work on Windows\n>  2) the working copies are not aware of each other, so if you change a\n> checked out branch from another working copy you have to remember to git\n> reset your working copy before doing anything with it to get it back in\n> sync with the branch\n>  3) you have to remember not to delete the actual clone\n>  4) the working copies are not aware of each other, so it is possible for\n> objects needed by one working copy to get pruned from another one\n> \n> Personally, I use this script all the time to checkout multiple branches\n> at the same time taking care to stay away from the issues above, and\n> everything hums along nicely.\n> \n>> We are a team of Web developers and testers working on an application.\n>> There are always a few development branches and a stable branch, and\n>> testers need all the branches with the very latest code available at all\n>> times.\n>>\n>> The way we handle it at the moment is very simple because the server\n>> hosting the remote repository is the same that hosts the deployed\n>> instances of each branch, so when we push to the remote repository, the\n>> code for each site is automatically updated.\n>>\n>> We use the following structure:\n>> /srv/repositories/project/branch1\n>> /srv/repositories/project/branch2\n>> /srv/repositories/project/branch3\n>>\n>> Is there any simple way to do this with Git? I can only think of two\n>> options that involve hooks:\n>>\n>>     * Have a hook that exports each branch to a directory like\n>>       /srv/repositories/project/branchN\n>>     * Have one Git repository per branch, so that each repository have a\n>>       different checkout active. Then the main remote repository will\n>>       have post-receive hooks that trigger a pull on each individual\n>>\n>> I'm not particularly happy with either way. Is there a better solution?\n> \n\n\n-- \nGustavo Narea.\nSoftware Developer.\n2degrees, Ltd. <http://dev.2degreesnetwork.com/>.\n"},{"id":"151815","messageId":"201009271853.53564.martin@siamect.com","threadId":"25219","inReplyTo":"4CA072FC.3020004@tech.2degreesnetwork.com","subject":"Re: Multiple checkouts active for the same repository","fromName":"Martin Pettersson","fromEmail":"martin@siamect.com","sentAt":"2010-09-27T11:53:53Z","receivedAt":"2010-09-27T11:53:53Z","isPatch":false,"sender":{"key":"martin@siamect.com","avatar":"https://gravatar.com/avatar/97ed731b9c70a7342247447388d2d3581a1316ad8b69979ab88efd37b9de5f1a?d=mp&s=160"},"body":"On Monday, September 27, 2010 05:33:32 pm Gustavo Narea wrote:\n> Hello,\n> \n> Thanks! I've given git-new-workdir a try and it seems to be what I was\n> searching for.\n> \n>  - Gustavo.\n> \n> On 24/09/10 16:33, Julian Phillips wrote:\n> > On Fri, 24 Sep 2010 10:29:47 +0100, Gustavo Narea\n> > \n> > <gnarea@tech.2degreesnetwork.com> wrote:\n> >> Hello.\n> >> \n> >> We're currently migrating from another DVCS, which allows us to have\n> >> working copies of each branch in separate directories, so that their\n> >> code can be used simultaneously. However, I haven't found a way to do\n> >> this with Git, at least not an easy way. Can you please help me?\n> > \n> > The git-new-workdir script to be found in contrib/workdir allows multiple\n> > working copies to share the same repository - though there are some\n> > \n> > caveats:\n> >  1) uses symbolic links, so doesn't work on Windows\n> >  2) the working copies are not aware of each other, so if you change a\n> > \n> > checked out branch from another working copy you have to remember to git\n> > reset your working copy before doing anything with it to get it back in\n> > sync with the branch\n> > \n> >  3) you have to remember not to delete the actual clone\n> >  4) the working copies are not aware of each other, so it is possible for\n> > \n> > objects needed by one working copy to get pruned from another one\n> > \n> > Personally, I use this script all the time to checkout multiple branches\n> > at the same time taking care to stay away from the issues above, and\n> > everything hums along nicely.\n> > \n> >> We are a team of Web developers and testers working on an application.\n> >> There are always a few development branches and a stable branch, and\n> >> testers need all the branches with the very latest code available at all\n> >> times.\n> >> \n> >> The way we handle it at the moment is very simple because the server\n> >> hosting the remote repository is the same that hosts the deployed\n> >> instances of each branch, so when we push to the remote repository, the\n> >> code for each site is automatically updated.\n> >> \n> >> We use the following structure:\n> >> /srv/repositories/project/branch1\n> >> /srv/repositories/project/branch2\n> >> /srv/repositories/project/branch3\n> >> \n> >> Is there any simple way to do this with Git? I can only think of two\n> >> \n> >> options that involve hooks:\n> >>     * Have a hook that exports each branch to a directory like\n> >>     \n> >>       /srv/repositories/project/branchN\n> >>     \n> >>     * Have one Git repository per branch, so that each repository have a\n> >>     \n> >>       different checkout active. Then the main remote repository will\n> >>       have post-receive hooks that trigger a pull on each individual\n> >> \n> >> I'm not particularly happy with either way. Is there a better solution?\njust check out the branch you need... If you are absolutely in big need of \nreaching multiple branches at the same time just make a couple of clones...\nMartin\n"}]}