Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

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.