{"thread":{"id":"10250","subject":"How to have multiple working copy directories use the same repository?","startedAt":"2007-10-11T18:10:50Z","lastAt":"2007-10-12T03:52:19Z","messageCount":4,"participants":["Bill Priest","Alex Riesen","Sergio","Shawn O. Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"55491","messageId":"744844.82514.qm@web55015.mail.re4.yahoo.com","threadId":"10250","inReplyTo":null,"subject":"How to have multiple working copy directories use the same repository?","fromName":"Bill Priest","fromEmail":"priestwilliaml@yahoo.com","sentAt":"2007-10-11T18:10:50Z","receivedAt":"2007-10-11T18:10:50Z","isPatch":false,"sender":{"key":"priestwilliaml@yahoo.com","avatar":null},"body":"All,\n  My current business requirements make it\nadvantageous to have two concurrent working\ndirectories (that have similar file structure; but not\nexactly the same); I need to maintain two separate\nbuilds that are always up to date.  Each working\ndirectory would be associated with a particular\nbranch/line of branches (think of two different\nhardware platforms that have considerable overlap).  A\ncomplication to this is that I need to use git-svn as\nthe remainder of the team uses svn (I just changed\nfrom cvs to svn last Jan so it is a hard sell to\nmanagement to change again).  I'm using git for the\nmerge capabilities.\n  I've looked at the \"git for CVS users\" section in\nthe docs and this appears to create two repositories. \nIs there a way to have two working directories that\nutilize the same repository?\n  I'm betting that I'm just trying to push my workflow\nstyle onto git instead of adapting to the git way of\ndoing things; but thought I would ask.\n\nTIA,\n\nBill\nPS.  I'm trying to avoid the push in the commit, push,\nmerge, dcommit cycle.\n\n\n\n       \n____________________________________________________________________________________\nYahoo! oneSearch: Finally, mobile search \nthat gives answers, not web links. \nhttp://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC\n"},{"id":"55493","messageId":"20071011190025.GC2804@steel.home","threadId":"10250","inReplyTo":"744844.82514.qm@web55015.mail.re4.yahoo.com","subject":"Re: How to have multiple working copy directories use the same repository?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-10-11T19:00:25Z","receivedAt":"2007-10-11T19:00:25Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Bill Priest, Thu, Oct 11, 2007 20:10:50 +0200:\n>   I've looked at the \"git for CVS users\" section in\n> the docs and this appears to create two repositories. \n> Is there a way to have two working directories that\n> utilize the same repository?\n\nLook for \"alternates\" in git's documentation. But read all the\nwarnings regarding git-gc and git-prune. Make a note of \".keep\" files.\n\n>   I'm betting that I'm just trying to push my workflow\n> style onto git instead of adapting to the git way of\n> doing things; but thought I would ask.\n\nGit is flexible enough to accomodate almost any existing workflow.\nJust some of them work better.\n"},{"id":"55498","messageId":"loom.20071011T191233-202@post.gmane.org","threadId":"10250","inReplyTo":"744844.82514.qm@web55015.mail.re4.yahoo.com","subject":"Re: How to have multiple working copy directories use the same repository?","fromName":"Sergio","fromEmail":"sergio.callegari@gmail.com","sentAt":"2007-10-11T19:21:10Z","receivedAt":"2007-10-11T19:21:10Z","isPatch":false,"sender":{"key":"sergio.callegari@gmail.com","avatar":"https://gravatar.com/avatar/c98f41317e0422c1e630385de0e3970227b8e5ad15f35ba8586066467cc833bc?d=mp&s=160"},"body":"One possibility can be to use the \"git-new-workdir\"\nscript that is distributed in the contrib directory\nof git source. It allows to have many work dirs insisting\non the same repo (yet possibly operating on different branches!)\n\nI believe that you might need to be careful with that,\nthough:\n\n1) There is no check about the possibility of messing things\nup by working on the same branch from two points.\n2) There should be a basic infrastructure to avoid nasty\nthings from happening but I do not know if it is complete.\n3) Implementation is based on symlinks in the git directory,\nso it is only for architectures supporting symlinks and, since\nthere are many symlinks, if something gets changed by mistake and\nsome symlink looses consistency with the others bad things may\nhappen.\n\nSergio  \n"},{"id":"55521","messageId":"20071012035219.GB27899@spearce.org","threadId":"10250","inReplyTo":"20071011190025.GC2804@steel.home","subject":"Re: How to have multiple working copy directories use the same repository?","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-10-12T03:52:19Z","receivedAt":"2007-10-12T03:52:19Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> wrote:\n> Bill Priest, Thu, Oct 11, 2007 20:10:50 +0200:\n> >   I've looked at the \"git for CVS users\" section in\n> > the docs and this appears to create two repositories. \n> > Is there a way to have two working directories that\n> > utilize the same repository?\n> \n> Look for \"alternates\" in git's documentation. But read all the\n> warnings regarding git-gc and git-prune. Make a note of \".keep\" files.\n\nReally I think Bill wants the contrib/workdir/git-new-workdir script.\n\nIts downside is that it makes heavy use of symlinks under the\n.git directory for the secondary working directories, and you do\nhave to watch out for committing changes to a branch when more\nthan one working directory has that branch as its current branch.\nBut otherwise it works very well for this use case.\n\nAlso you may get a few warnings from your HEAD reflog saying objects\nno longer exist when you do a git-gc within a working directory.\nThis can happen for example if you use `git rebase -i` in a working\ndirectory a few times and then later run git-gc from a different\nworking directory.  But since its just intermediate rebase state\nits probably not that big of a deal to have it go missing.\n\nYou shouldn't run `git gc --prune` if any of the working directories\nhas staged but uncommitted changes in them.  Such changes are held\nin the working directory's index, which will not be considered\nas reachable (as it isn't visible to git-gc) and the objects will\nbe pruned.  That would not too be pleasant to debug.\n\nHeh.  As you can see it has some \"issues\" with its use.  Its a very\npowerful tool, but it does give you more than enough room to shoot\nyourself in the foot.  Using it is like tieing a gun to your ankle,\nkeeping it aimed at your big toe at all times, with a string tied\nto your wrist and the gun's trigger.  Reach too far and *bam*.\nWhich is why its still in contrib status.\n \n-- \nShawn.\n"}]}