add the following line to your ~/.bashrc
alias gtree="fd '\.git$' --prune -utd | tree --fromfile ."
And then you can use gtree
to find all repos under current directory. With some extra effort, one can cd into any repo folder with tab completion.
This gist is from one of my stackoverflow answer for How to quickly find all git repos under a directory
I am a big fan of fd as it is so much faster than find.
fd '\.git$' --prune -u -t d -x echo {//}
./group1/repo1
./group1/repo2
./group2/repo3
./group2/repo4
and with tree
, it's even better
fd '\.git$' --prune -utd | tree --fromfile .
.
├── group1
│ ├── repo1
│ ├── repo2
└── group2
├── repo3
└── repo4
now just add an alias to your ~/.bashrc
alias gtree="fd '\.git$' --prune -utd | tree --fromfile ."
just do gtree
to find your repo
If you are crazy like me, you'll write a script like the bash_completion
code gcd.sh
below
now gcd
tab will get you all the repos under the current directory, or gcd
when you are deep under a git repo brings you to the root of your git repo.