{"thread":{"id":"20661","subject":"New to Git / Questions about single user / multiple projects","startedAt":"2009-08-19T01:52:36Z","lastAt":"2009-08-19T13:20:54Z","messageCount":11,"participants":["Rob (gmail)","Changsheng Jiang","Daniel Barkalow","Chris Packham","Jakub Narebski","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"121202","messageId":"a2db4dd50908181852s1e2c64fen8b883faf76b3136d@mail.gmail.com","threadId":"20661","inReplyTo":null,"subject":"New to Git / Questions about single user / multiple projects","fromName":"Rob (gmail)","fromEmail":"robvanb@gmail.com","sentAt":"2009-08-19T01:52:36Z","receivedAt":"2009-08-19T01:52:36Z","isPatch":false,"sender":{"key":"robvanb@gmail.com","avatar":"https://gravatar.com/avatar/8112fae50a0384d83e160ff7fa3d206a74f34bab5c6745754fa5262b8683edc5?d=mp&s=160"},"body":"I'm new to git and have some (I think) basic questions that I have not\nbeen able to find answers to in the documentation.\nIt's very possible that these are the result of my lack in\nunderstanding git / version control, so feel free to point me to\ndocumentation\nthat might contain the answers.\n\nI'm doing ERP development for my job and various 'hobby' development\nin my spare time.\nI'd like to track/store/ version control the code that I write for\nboth work and play.\nI am (currently) working by myself, no need to have multiple\ndevelopers working of the same code.\n\nQ1:\nCan I create a single repository (project?) for all my code, knowing\nthat there are multiple small, unrelated projects. Or should I create\na new repository for each project ?\n\nQ2:\nAfter initalizing my repository, and comitting the 1st batch of code:\nWhen further working on the code, will the command \"git add .\" add all\nchanged and new files ? Or do I specifically need to list the new\nfiles ?\n\nQ3: Can I run 'git add x' in any subdirectory, or do I need to issue\nif from the root of the project ?\n\nThanks,\n\nRob.\n\n--\nWhen in trouble or in doubt, run in circles, scream and shout\n"},{"id":"121203","messageId":"eafc0afe0908181924x60e5dd23vd37711db880ead84@mail.gmail.com","threadId":"20661","inReplyTo":"a2db4dd50908181852s1e2c64fen8b883faf76b3136d@mail.gmail.com","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Changsheng Jiang","fromEmail":"jiangzuoyan@gmail.com","sentAt":"2009-08-19T02:24:46Z","receivedAt":"2009-08-19T02:24:46Z","isPatch":false,"sender":{"key":"jiangzuoyan@gmail.com","avatar":"https://gravatar.com/avatar/61eb7704963065c5937698bacbc1412b6083e1d43f2cc9642999fe10b2e582f8?d=mp&s=160"},"body":"I am not that familiar with git too, but see the answers below\nquestions, respectively, and fix me if i am wrong.\n\nOn Wed, Aug 19, 2009 at 09:52, Rob (gmail) <robvanb@gmail.com> wrote:\n>\n> I'm new to git and have some (I think) basic questions that I have not\n> been able to find answers to in the documentation.\n> It's very possible that these are the result of my lack in\n> understanding git / version control, so feel free to point me to\n> documentation\n> that might contain the answers.\n>\n> I'm doing ERP development for my job and various 'hobby' development\n> in my spare time.\n> I'd like to track/store/ version control the code that I write for\n> both work and play.\n> I am (currently) working by myself, no need to have multiple\n> developers working of the same code.\n>\n> Q1:\n> Can I create a single repository (project?) for all my code, knowing\n> that there are multiple small, unrelated projects. Or should I create\n> a new repository for each project ?\ngit-submodule\n>\n> Q2:\n> After initalizing my repository, and comitting the 1st batch of code:\n> When further working on the code, will the command \"git add .\" add all\n> changed and new files ? Or do I specifically need to list the new\n> files ?\n=git status= or =git ls-files= will list the files in different statuses.\n\nIf there are no other files, such as backup file produced by editor,\nyou can run =git add .=. If there are, try to configure in file\n=.git/info/exclude= or =.gitignore=.\n\nChanged files can be committed automatically by =git commit -a=\n>\n> Q3: Can I run 'git add x' in any subdirectory, or do I need to issue\n> if from the root of the project ?\nYou can.\n>\n> Thanks,\n>\n> Rob.\n>\n> --\n> When in trouble or in doubt, run in circles, scream and shout\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n                                                     Changsheng Jiang\n"},{"id":"121207","messageId":"alpine.LNX.2.00.0908182343210.7195@iabervon.org","threadId":"20661","inReplyTo":"a2db4dd50908181852s1e2c64fen8b883faf76b3136d@mail.gmail.com","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2009-08-19T04:00:19Z","receivedAt":"2009-08-19T04:00:19Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Tue, 18 Aug 2009, Rob (gmail) wrote:\n\n> I'm new to git and have some (I think) basic questions that I have not\n> been able to find answers to in the documentation.\n> It's very possible that these are the result of my lack in\n> understanding git / version control, so feel free to point me to\n> documentation\n> that might contain the answers.\n> \n> I'm doing ERP development for my job and various 'hobby' development\n> in my spare time.\n> I'd like to track/store/ version control the code that I write for\n> both work and play.\n> I am (currently) working by myself, no need to have multiple\n> developers working of the same code.\n> \n> Q1:\n> Can I create a single repository (project?) for all my code, knowing\n> that there are multiple small, unrelated projects. Or should I create\n> a new repository for each project ?\n\nIt's much easier to have a new repository for each project. There are two \npossible ways to put multiple projects in a single repository: (1) you \ncould have each one in a subdirectory, which is bad because each commit \nrecords the entire tree, so each project would have commits in its history \nthat are about other projects; (2) you could have separate branches for \neach project; this is fine, but you only get one working directory per \nrepository, so it's awkward because you can only have one of your projects \nchecked out at a time.\n\nOn the other hand, it's pretty trivial to have lots of repositories, and \nthere isn't really any disadvantage to it. In fact, you may want to have \nmore repositories than projects at times, if you use the same project for \nmultiple purposes and want to extend it in different ways at the same \ntime.\n\n> Q2:\n> After initalizing my repository, and comitting the 1st batch of code:\n> When further working on the code, will the command \"git add .\" add all\n> changed and new files ? Or do I specifically need to list the new\n> files ?\n\nYou can use \"git add .\", but be aware that this tends to pick up random \ncruft you've left in the directory.\n\n> Q3: Can I run 'git add x' in any subdirectory, or do I need to issue\n> if from the root of the project ?\n\nYou can run almost every git command from subdirectories, and it does what \nyou'd expect with filenames when you're in a subdirectory. E.g., \"git add \nx\" while in \"a/b/\" is like being in the project root and running \"git add \na/b/x\"\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"121209","messageId":"a038bef50908182114s26d3685r9757fa77b9f41211@mail.gmail.com","threadId":"20661","inReplyTo":"eafc0afe0908181924x60e5dd23vd37711db880ead84@mail.gmail.com","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Chris Packham","fromEmail":"judge.packham@gmail.com","sentAt":"2009-08-19T04:14:14Z","receivedAt":"2009-08-19T04:14:14Z","isPatch":false,"sender":{"key":"judge.packham@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155667?v=4"},"body":"My $0.02\n\nOn Wed, Aug 19, 2009 at 1:52 PM, Rob (gmail)<robvanb@gmail.com> wrote:\n> Q1:\n> Can I create a single repository (project?) for all my code, knowing\n> that there are multiple small, unrelated projects. Or should I create\n> a new repository for each project ?\n\nThats entirely up to you. I prefer keeping lots of little repositories\nfor unrelated projects. That way I can use cool things like git\narchive to generate tarballs if/when I need to. Although I do use the\nsingle repository method sometimes when I'm feeling lazy. One thing\ngit has over some other VCSes is the ability to track changes past\nrenames. That way you can start off lazy and just have a fairly flat\ncode structure and then as you start to group code into logical sets\nyou can move them into directories without any danger of losing\nhistory (one tip though, do the moving as a commit on its own this\nmakes the re-name detection work a lot better).\n\nAs Changsheng pointed out. You can also have the best of both worlds\nand use git submodules to tie together multiple repositories. Although\nI've always though of submodules as more of a build tool when you want\nto track components of a larger system i.e. a linux distro might track\nthe kernel, kde, gnome ... and use a submodule setup to track known\nstable points where those components work together.\n\n>\n> Q2:\n> After initalizing my repository, and comitting the 1st batch of code:\n> When further working on the code, will the command \"git add .\" add all\n> changed and new files ? Or do I specifically need to list the new\n> files ?\n\nYou can use 'git add -u' which adds any locally modified (but not\ncompletely new) files to the index (its basically the first half of\n'git commit -a'). For the new files either 'git add .' or list the\nfiles.\n\n> Q3: Can I run 'git add x' in any subdirectory, or do I need to issue\n> if from the root of the project ?\n\nYes all the git commands work from subdirectories (well except\ninit/clone) . This is actually really useful if you want to get the\nhistory of a component in a large code base without getting a lot of\nirrelevant changes in other components.\n"},{"id":"121220","messageId":"m3ab1wnsie.fsf@localhost.localdomain","threadId":"20661","inReplyTo":"a2db4dd50908181852s1e2c64fen8b883faf76b3136d@mail.gmail.com","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-08-19T07:59:42Z","receivedAt":"2009-08-19T07:59:42Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"\"Rob (gmail)\" <robvanb@gmail.com> writes:\n\n> I'm new to git and have some (I think) basic questions that I have\n> not been able to find answers to in the documentation.  It's very\n> possible that these are the result of my lack in understanding git /\n> version control, so feel free to point me to documentation that\n> might contain the answers.\n\nDocumentation you might want to read: \n\n* \"Git User's Manual\", distributed with Git (installed at least on\n  Linux at $sharedir/doc/git-$version/user-manual.html), also at\n  http://www.kernel.org/pub/software/scm/git/docs/user-manual.html\n\n* \"The Git Community Book\", available at\n  http://book.git-scm.com/\n\n* \"Pro Git.  Professional version control\", available at\n  http://progit.org/book/\n\n> Q1:\n> Can I create a single repository (project?) for all my code, knowing\n> that there are multiple small, unrelated projects. Or should I create\n> a new repository for each project ?\n\nYou should create a new repository for each project.  In git each\ncommit is about state of whole repository.\n\n\nIf you have single unrelated files, you might want to consider using\nZit tool (see http://git.or.cz/gitwiki/InterfacesFrontendsAndTools for\ndetails), but beware that it is in early stages of development.\n\n(Although if you choose one big repository, you can split it later\nwith some effort using git-filter-branch (or git-split somewhere in\nmailing list archives) if you didn't publish your repositories).\n \n> Q2:\n> After initalizing my repository, and comitting the 1st batch of code:\n> When further working on the code, will the command \"git add .\" add all\n> changed and new files ? Or do I specifically need to list the new\n> files ?\n\n\"git add .\" would add _all_ new not ignored files, and would stage all\nchanged files.  But you would have to be sure that all files you don't\nwant to be comitted, like generated files (*.o, *.log,...) and backup\nfiles of your editor (*~ or *.bak), are ignored using .gitignore\n(usually for generated files) and .git/info/excludes or\ncore.excludesFile (usually for specific patterns like backup files).\n\n> Q3: Can I run 'git add x' in any subdirectory, or do I need to issue\n> if from the root of the project ?\n\nMost git commands take subdirectory they are in into consideration\nwhen acting.  \"git add <filename>\" in subdirectory works as expected.\n\nNote that some commands need to have '.' as filename / pattern to be\nlimited to current subdirectory / act on current directory.\n\n> --\n> When in trouble or in doubt, run in circles, scream and shout\n\n:-)\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"121241","messageId":"a2db4dd50908190400x1cbb1506sa38c60e31587f49d@mail.gmail.com","threadId":"20661","inReplyTo":"m3ab1wnsie.fsf@localhost.localdomain","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Rob (gmail)","fromEmail":"robvanb@gmail.com","sentAt":"2009-08-19T11:00:45Z","receivedAt":"2009-08-19T11:00:45Z","isPatch":false,"sender":{"key":"robvanb@gmail.com","avatar":"https://gravatar.com/avatar/8112fae50a0384d83e160ff7fa3d206a74f34bab5c6745754fa5262b8683edc5?d=mp&s=160"},"body":"Thanks all for all the answers :)\n\nOne last question based on the multiple projects issue:\nIs there a command that lists all your projects ?\n\nMy initial thought is that there probably isn't, as there is no\nrelation between the project except the userID ?\n\nThanks again,\nRob.\n\nOn Wed, Aug 19, 2009 at 3:59 AM, Jakub Narebski<jnareb@gmail.com> wrote:\n> \"Rob (gmail)\" <robvanb@gmail.com> writes:\n>\n>> I'm new to git and have some (I think) basic questions that I have\n>> not been able to find answers to in the documentation.  It's very\n>> possible that these are the result of my lack in understanding git /\n>> version control, so feel free to point me to documentation that\n>> might contain the answers.\n>\n> Documentation you might want to read:\n>\n> * \"Git User's Manual\", distributed with Git (installed at least on\n>  Linux at $sharedir/doc/git-$version/user-manual.html), also at\n>  http://www.kernel.org/pub/software/scm/git/docs/user-manual.html\n>\n> * \"The Git Community Book\", available at\n>  http://book.git-scm.com/\n>\n> * \"Pro Git.  Professional version control\", available at\n>  http://progit.org/book/\n>\n>> Q1:\n>> Can I create a single repository (project?) for all my code, knowing\n>> that there are multiple small, unrelated projects. Or should I create\n>> a new repository for each project ?\n>\n> You should create a new repository for each project.  In git each\n> commit is about state of whole repository.\n>\n>\n> If you have single unrelated files, you might want to consider using\n> Zit tool (see http://git.or.cz/gitwiki/InterfacesFrontendsAndTools for\n> details), but beware that it is in early stages of development.\n>\n> (Although if you choose one big repository, you can split it later\n> with some effort using git-filter-branch (or git-split somewhere in\n> mailing list archives) if you didn't publish your repositories).\n>\n>> Q2:\n>> After initalizing my repository, and comitting the 1st batch of code:\n>> When further working on the code, will the command \"git add .\" add all\n>> changed and new files ? Or do I specifically need to list the new\n>> files ?\n>\n> \"git add .\" would add _all_ new not ignored files, and would stage all\n> changed files.  But you would have to be sure that all files you don't\n> want to be comitted, like generated files (*.o, *.log,...) and backup\n> files of your editor (*~ or *.bak), are ignored using .gitignore\n> (usually for generated files) and .git/info/excludes or\n> core.excludesFile (usually for specific patterns like backup files).\n>\n>> Q3: Can I run 'git add x' in any subdirectory, or do I need to issue\n>> if from the root of the project ?\n>\n> Most git commands take subdirectory they are in into consideration\n> when acting.  \"git add <filename>\" in subdirectory works as expected.\n>\n> Note that some commands need to have '.' as filename / pattern to be\n> limited to current subdirectory / act on current directory.\n>\n>> --\n>> When in trouble or in doubt, run in circles, scream and shout\n>\n> :-)\n>\n> --\n> Jakub Narebski\n> Poland\n> ShadeHawk on #git\n>\n\n\n\n-- \nWhen in trouble or in doubt, run in circles, scream and shout\n"},{"id":"121242","messageId":"200908191418.08838.jnareb@gmail.com","threadId":"20661","inReplyTo":"a2db4dd50908190400x1cbb1506sa38c60e31587f49d@mail.gmail.com","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-08-19T12:18:07Z","receivedAt":"2009-08-19T12:18:07Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Please do not toppost, and when responding cull the quoted part, \nso only those parts that are relevant to your reply are remaining.\n\nOn Wed, 19 Aug 2009, Rob wrote:\n\n> Thanks all for all the answers :)\n> \n> One last question based on the multiple projects issue:\n> Is there a command that lists all your projects ?\n> \n> My initial thought is that there probably isn't, as there is no\n> relation between the project except the userID ?\n\nNo, there no git commands for listing all your projects.  BTW. you can\nuse different identities for different projects by setting it\nin .git/config, i.e. in per-repository configuration file.\n\n\nSimple solution, which finds only non-bare repositories, and which\ncan find false positives:\n\n $ find ~ -name \".git\" -type d -print\n\nMore complicated solution, used by gitweb, requires Perl, not checked\nthat it works correctly, doesn't work with ancient repositories with\nsymlink HEAD.\n\n $ perl -e '\n use File::Find qw(find);\n my @list = ();\n find({follow_fast => 1, follow_skip => 2, dangling_symlinks => 0,\n       wanted => sub {\n         return if (m!^[/.]$!);\n         return unless (-d $_);\n         push @list, $_ if -e \"$_/HEAD\" \n       }});\n print join(\"\\n\", @list).\"\\n\";\n '\n\n-- \nJakub Narebski\nPoland\n"},{"id":"121243","messageId":"a2db4dd50908190528o7f16b65are1acc89c900f7014@mail.gmail.com","threadId":"20661","inReplyTo":"200908191418.08838.jnareb@gmail.com","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Rob (gmail)","fromEmail":"robvanb@gmail.com","sentAt":"2009-08-19T12:28:04Z","receivedAt":"2009-08-19T12:28:04Z","isPatch":false,"sender":{"key":"robvanb@gmail.com","avatar":"https://gravatar.com/avatar/8112fae50a0384d83e160ff7fa3d206a74f34bab5c6745754fa5262b8683edc5?d=mp&s=160"},"body":"On Wed, Aug 19, 2009 at 8:18 AM, Jakub Narebski<jnareb@gmail.com> wrote:\n> Please do not toppost, and when responding cull the quoted part,\n> so only those parts that are relevant to your reply are remaining.\n\nSorry, n00b mistake.\n\n> BTW. you can\n> use different identities for different projects by setting it\n> in .git/config, i.e. in per-repository configuration file.\n\nThat seems like the best solution.\nHow do I delete my initial repository that I created and obviously messed up ?\n"},{"id":"121244","messageId":"20090819124820.GC20381@coredump.intra.peff.net","threadId":"20661","inReplyTo":"200908191418.08838.jnareb@gmail.com","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-19T12:48:21Z","receivedAt":"2009-08-19T12:48:21Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 19, 2009 at 02:18:07PM +0200, Jakub Narebski wrote:\n\n> More complicated solution, used by gitweb, requires Perl, not checked\n> that it works correctly, doesn't work with ancient repositories with\n> symlink HEAD.\n> \n>  $ perl -e '\n>  use File::Find qw(find);\n>  my @list = ();\n>  find({follow_fast => 1, follow_skip => 2, dangling_symlinks => 0,\n>        wanted => sub {\n>          return if (m!^[/.]$!);\n>          return unless (-d $_);\n>          push @list, $_ if -e \"$_/HEAD\" \n>        }});\n>  print join(\"\\n\", @list).\"\\n\";\n>  '\n\nThat doesn't seem very accurate. It will find 'HEAD' in \"logs/\" of\nrepositories with reflogs enabled, and \"refs/remotes/*/\" of cloned\nrepositories, giving you a lot of false positives.\n\nIf you want accuracy, you can ask git rev-parse to verify whether a\ndirectory is a git repo; it actually uses a few different heuristics to\ncheck. For example:\n\n  find . -type d |\n    while read dir; do\n      if GIT_DIR=$dir git rev-parse --git-dir >/dev/null 2>&1; then\n        echo $dir\n      fi\n    done\n\nbut it is a bit slower, as you invoke rev-parse for every directory, and\nit actually does some verification of the contents of HEAD (so it is\nprobably a bad idea for something like gitweb, which cares about\nperformance).\n\nIf you want to do a cheap and fast check, searching for 'HEAD', 'refs',\nand 'objects' in the same directory is a reasonable heuristic.\n\n-Peff\n"},{"id":"121245","messageId":"20090819124924.GD20381@coredump.intra.peff.net","threadId":"20661","inReplyTo":"a2db4dd50908190528o7f16b65are1acc89c900f7014@mail.gmail.com","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-08-19T12:49:24Z","receivedAt":"2009-08-19T12:49:24Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Aug 19, 2009 at 08:28:04AM -0400, Rob (gmail) wrote:\n\n> That seems like the best solution.\n> How do I delete my initial repository that I created and obviously\n> messed up ?\n\nIf you have nothing of value in the whole directory, just \"rm -rf repo\".\nIf you want to keep the working tree but delete all of the git bits,\njust \"rm -rf .git\".\n\n-Peff\n"},{"id":"121251","messageId":"200908191520.56436.jnareb@gmail.com","threadId":"20661","inReplyTo":"20090819124820.GC20381@coredump.intra.peff.net","subject":"Re: New to Git / Questions about single user / multiple projects","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-08-19T13:20:54Z","receivedAt":"2009-08-19T13:20:54Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Wed, 19 August 2009, Jeff King <peff@peff.net> wrote:\n> On Wed, Aug 19, 2009 at 02:18:07PM +0200, Jakub Narebski wrote:\n> \n> > More complicated solution, used by gitweb, requires Perl, not checked\n> > that it works correctly, doesn't work with ancient repositories with\n> > symlink HEAD.\n> > \n> >  $ perl -e '\n> >  use File::Find qw(find);\n> >  my @list = ();\n> >  find({follow_fast => 1, follow_skip => 2, dangling_symlinks => 0,\n> >        wanted => sub {\n> >          return if (m!^[/.]$!);\n> >          return unless (-d $_);\n> >          push @list, $_ if -e \"$_/HEAD\" \n> >        }});\n> >  print join(\"\\n\", @list).\"\\n\";\n> >  '\n> \n> That doesn't seem very accurate. It will find 'HEAD' in \"logs/\" of\n> repositories with reflogs enabled, and \"refs/remotes/*/\" of cloned\n> repositories, giving you a lot of false positives.\n\nTo be more exact it is simplified solution used by git; in this case \n_oversimplified_, as gitweb doesn't have problems with 'HEAD' in \nremote-tracking branches.\n\nOn the other hand gitweb currently does not detect submodules or \nsubmodule-like repositories, i.e. repositories inside working directory\nof other repository.  So this could be improved...\n\n> \n> If you want accuracy, you can ask git rev-parse to verify whether a\n> directory is a git repo; it actually uses a few different heuristics to\n> check. For example:\n> \n>   find . -type d |\n>     while read dir; do\n>       if GIT_DIR=$dir git rev-parse --git-dir >/dev/null 2>&1; then\n\nOr \"git --git-dir=$dir rev-parse 2> /dev/null\"\n\n>         echo $dir\n>       fi\n>     done\n> \n> but it is a bit slower, as you invoke rev-parse for every directory, and\n> it actually does some verification of the contents of HEAD (so it is\n> probably a bad idea for something like gitweb, which cares about\n> performance).\n> \n> If you want to do a cheap and fast check, searching for 'HEAD', 'refs',\n> and 'objects' in the same directory is a reasonable heuristic.\n\nIf one follow preferred git conventions for naming non-bare repositories,\nand one doesn't have anything funny,\n\n  $ find . -name \"*.git\" -type d\n\nshould be sufficient.\n-- \nJakub Narebski\nPoland\n"}]}