Skip to content

Instantly share code, notes, and snippets.

@brucevanhorn2
Last active November 29, 2022 17:45
Show Gist options
  • Save brucevanhorn2/096ada8de76b2f599493b38bec6cfc9c to your computer and use it in GitHub Desktop.
Save brucevanhorn2/096ada8de76b2f599493b38bec6cfc9c to your computer and use it in GitHub Desktop.
See all the updates for my projects in git

Latest Update Report

Your scrum master says

Knock knock

Who's there?

Water

Water who?

Water you working on today?

Have you ever encountered devs who say the same thing in stand-up every day? "I'm still working on project foo and I don't need any help." That's lame. You have no idea what they're really doing. I use this script to see what my developers have pushed recently on each repo in my project. I cobbled this together because manually searching through the Azure DevOps repos is painful when you have a lot of projects running. You want to know has Mr. Foo committed anything lately? You'd have to look through all the repos, and all the branches. This script automates this task.

The output is useful in other ways. You'll see stale branch that haven't been touched in weeks.

Run this is Linux / WSL 2 like this:

./latest-updates.sh /mnt/c/vsi/src/6/

The argument is the base path. The argument contains the names of the repos you want to scan. The script moves through each repo folder, performs an update, then does its git log magic to show you the most recent commits.

Please note this is only as robust as I need it to be. I don't check for invalid paths, etc. The script assumes you check all our projects out to a single folder. Note the trailing / is also needed in the path.

image

Pro Tip

If you're a lead dev and you are working on the project yourself, it helps to keep a separate copy of all your project code separate from where you work on it. By this I mean the all my code is in a folder called c:\foo\src, but I have a folder c:\temp\foo\src with its own set of cloned projects. That's the location I would use for this script. This is because if I'm working on the code and I have uncommitted changes when I run the script, the script will fail because I need to either push / commit / stash changes before it's going to pull the latest changes.

if [ $# -eq 0 ]
then
echo "No arguments supplied. Where are the codez?"
exit 1
fi
projects=("Arbiter" "Didact" "Escharum" "Flood" "Forerunner" "ForwardUntoDawn" "Huragok" "Promethean" "Spartan2")
for project in ${projects[@]}; do
echo "---------------- $project -----------------------------"
cd $1$project
git pull
git branch -r | grep -v HEAD | while read b; do git log --color --format="%ci _%C(magenta)%cr %C(bold cyan)$b%Creset %s %C(bold blue)<%an>%Creset" $b | head -n 1; done | sort -r | cut -d_ -f2- | sed 's;origin/;;g' | head -10
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment