Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tatarurzvn/c1af1d9d48c88df18d42eb8251376046 to your computer and use it in GitHub Desktop.
Save tatarurzvn/c1af1d9d48c88df18d42eb8251376046 to your computer and use it in GitHub Desktop.
#!/bin/bash
output_file="all_git_outputs.txt"
> "$output_file"
for dir in */; do
if [ -d "$dir/.git" ]; then
repo_name=$(basename "$dir")
echo "Processing $dir"
cd "$dir"
git fetch --all
git for-each-ref --format='%(committerdate)%09%(authorname)%09%(refname)' | \
sort -k5n -k2M -k3n -k4n | \
grep remotes | \
awk -F "\t" -v repo="$repo_name" '/-000/ { printf "%-32s %-27s %s\n", repo, $2, $3 }' >> ../"$output_file"
cd ..
fi
done
echo "Output written to $output_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment