Skip to main content

Shell Command To Find All Git Repos In Current Directory And Run Git Command

By November 10, 2016Blog, Shell/Terminal
Allure Web Solutions Code Snippet

This shell scripts recurses through all child folders to find any git repos and execute a command. In the example below we are executing git pull on all repos inside the current folder.

for git_dir in $(find . -type d -name .git); do git -C $(dirname "$git_dir") pull; done

If you want to run a different command, just replace pull above with any command you want.

allure

Author allure

More posts by allure

Leave a Reply

Designed by

best down free | web phu nu so | toc dep 2017