I have been searching for a solution to this for a while and have not found quite what I need.
I have several Git Repositories in a folder on my Mac (OSX 10.6) and
Very late to the party, but I wrote a tool to do this for me. It's a simple shell script, and it can be found on Github.
It looks like this:
There's a Python based program, uncommitted that sounds like it would do exactly what you want. There's no git support for it yet (just hg and Subversion), but you may be able to help the author implement git support in his app, or take his ideas as how to implement your stuff (he documents his finding method on the project page I linked to).
If you just want the status of files in local repos, something like this: http://gist.github.com/389478 should do the trick. You'll need to modify the pattern in the for
loop to pickup whatever directories you want.
There is also a ruby gem for this that works as a git sub command: https://github.com/reednj/git-status-all
# install the gem
gem install git-status-all
# use the status-all subcommand to scan the directory
git status-all
This is an easy way of doing such things in in a one-liner. I am missing one last step that I will add once I find it out (unless someone else know it).
For a git status
you can do:
find ./Sites -name .git | awk '{ print "git --git-dir=" $1 " --work-tree " substr($1,1,length($1) - 4) " status" }'
then copy the output and execute it.
For a complete diff, you can run:
find ./Sites -name .git | awk '{ print "git --git-dir=" $1 " --work-tree " substr($1,1,length($1) - 4) " --no-pager diff" }'
The copy-paste things that you must do annoys me. It should be using also xargs
in there, but somehow, git complains:
find ./Sites -name .git | awk '{ print "--git-dir=" $1 " --work-tree " substr($1,1,length($1) - 4) " --no-pager diff" }' | xargs git
If anyone knows how to fix the git complaint in this last command, please edit this answer.
Multiple repo status checking with jsut a single shell alias. No installation is required. All credits to: https://coderwall.com/p/grmruq/git-status-on-all-repos-in-folder
For bash:
alias gitstat='find . -maxdepth 1 -mindepth 1 -type d -exec sh -c "(echo {} && cd {} && git status -s && echo)" \;'
alias gitstatfull='find . -maxdepth 1 -mindepth 1 -type d -exec sh -c "(echo {} && cd {} && git status && echo)" \;'
or for Cshell
alias gitstat 'find . -maxdepth 1 -mindepth 1 -type d -exec sh -c "(echo {} && cd {} && git status -s && echo)" \;'
alias gitstatfull 'find . -maxdepth 1 -mindepth 1 -type d -exec sh -c "(echo {} && cd {} && git status && echo)" \;'