Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm new to linux and working with git. I have a directory (code) with a dozen sub directories (git repositories).

I want two commands I can run to

  • Get the current status of all repositories.
  • git pull new changes for all repositories.

I know this is probably very simple for someone who knows what they are doing, I just can't get the right loop executing (I am looping all files, not directories).

Thanks! Kyle

share|improve this question

2 Answers 2

Take a look at the mr utility. It's designed expressly for this purpose.

share|improve this answer

Try the find(1) command. You can tell it to search only for directories (-type d) and to search only a specified depth from your working directory (-maxdepth x). Further you can tell find to execute a command on every match instead of just printing its name (-exec).

For example, to run git status on all directories in your current working directory, do

find -type d -maxdepth 1 -exec git status {} \;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.