I would like to know if there is a way to determine which sub-folders under a specified directory are git projects. After which, check which of those git projects need updating via 'git fetch' or otherwise.
For example, I have a folder called development in my home folder, which holds various projects with about 10% of them using git. Rather than individually check for project updates I would like to be able to run a command which checks for any updates for all of the git folders in the development directory.
It would also be nice if it could update non-conflicting projects.
One way to get a list of all Git repos under your current directory is with the following command:
find . -name '.git' | xargs -n 1 dirname
You could then feed this into a shell script which runs your command of choice in each repository, either by changing to the directory or by using Git’s --git-dir
and --work-tree
arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With