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

link|improve this question

25% accept rate
feedback

2 Answers

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 {} \;
link|improve this answer
feedback

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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