Created
September 22, 2012 18:08
-
-
Save andyr/3767256 to your computer and use it in GitHub Desktop.
Print paths to all git repos in a directory tree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ls -lRA | grep "\.git:$" | sed 's/\.git://g' |
The output of the replaced command above properly produces the desired output (removes the trailing ".git" from the dir listing):
$ ls -lRA | grep "\.git:$" | sed 's/\.git://g'
./raspberrypi/firmware/
./raspberrypi/linux/
./raspberrypi/quake3/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, this command doesn't format the output as the top level repo directory only, but has parens around the regexp used in the awk statement to try and handle this last bit. I'm somewhat new to awk, so I left it as-is for the moment since it solves my problem of finding a bunch of disparate git repos in my home directory. The output of this command would look like the following.