Skip to content

Commit 55e2d4f

Browse files
committed
Update tip and add an alternative
Update find command to exclude hidden directories. Add GNU find command
1 parent 312b4a6 commit 55e2d4f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,17 @@ git rebase --interactive HEAD~2
698698

699699
## List of git repositories in multiple directories.
700700
```sh
701-
find /path1 /path2 /path3 -regex '.*\.git' -type d -print0 | xargs -0 -I {} dirname {}
701+
find -E ${targetdir} \( -regex '.*/\.git
702+
-not -regex '.*/\..*/\.git
703+
\) -type d -print0 | xargs -0 -I {} dirname {}
704+
```
705+
706+
707+
__Alternatives:__
708+
```sh
709+
find ${targetdir} -regextype posix-egrep \( -regex '.*/\.git
710+
-not -regex '.*/\..*/\.git
711+
\) -type d -print0 | xargs -0 -I {} dirname {}
702712
```
703713

704714
<!-- Don’t remove or change the comment below – that can break automatic updates. More info at <http://npm.im/doxie.inject>. -->

tips.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -313,5 +313,6 @@
313313
"tip": "git rebase --interactive HEAD~2"
314314
}, {
315315
"title": "List of git repositories in multiple directories.",
316-
"tip": "find /path1 /path2 /path3 -regex '.*\\.git' -type d -print0 | xargs -0 -I {} dirname {}"
316+
"tip": "find -E ${targetdir} \\( -regex '.*/\\.git$' -not -regex '.*/\\..*/\\.git$' \\) -type d -print0 | xargs -0 -I {} dirname {}",
317+
"alternatives": ["find ${targetdir} -regextype posix-egrep \\( -regex '.*/\\.git$' -not -regex '.*/\\..*/\\.git$' \\) -type d -print0 | xargs -0 -I {} dirname {}"]
317318
}]

0 commit comments

Comments
 (0)