Reputation: 20774
I have a directory that contains a bunch of git repos. All these repos have remotes in Github and Gitlab. What command can I execute to check, for each of these repos:
1- Which ones have uncommited changes. 2- Which ones have commits that have not been synced to the remote.
Upvotes: 0
Views: 175
Reputation: 4014
I keep this script around which lets me apply a git command to every subdirectory:
#!/usr/bin/env zsh
submodules=("${(@f)$(find . -type d -depth 1)}")
for submodule in $submodules
do
print "=== $submodule"
git --work-tree=$submodule --git-dir=$submodule/.git $*
print
done
[Edit] just to clarify: the submodule
variable name in the script really should have been subdirectory
. The script has nothing to do with git's submodule feature.
Upvotes: 1