I like to know what has been completed, but I don't enjoy the extra work of having to document it each time. Instead, I thought I could devise a script that utilizes diffing for this task.
I initially came up with this to get the commits:
git log main --author="$(git config user.email)" --since="midnight" --until="now" --pretty=format:"%H"
But then I realized I actually need the previous commit (to make the first diff) and loop through the commits.
#!/bin/bash # Get the last commit before today initial_commit_hash=$(git log main --author="$(git config user.email)" --until="midnight" --pretty=format:"%H" -1) # Get today's commits IFS=$'\n' read -r -d '' -a commits < <( git log main --author="$(git config user.email)" --since="midnight" --until="now" --pretty=format:"%H" --reverse && printf '\0' ) # Check if there are commits for today if [ ${#commits[@]} -gt 0 ]; then # If there's an initial commit from before today, include it in the diffs if [ ! -z "$initial_commit_hash" ]; then echo "Diff from the last commit before today ($initial_commit_hash) to the first commit of today (${commits[0]}):" git diff $initial_commit_hash ${commits[0]} echo "-------------------------------------------" fi # Loop through today's commits and display diffs for ((i=0; i < ${#commits[@]}-1; i++)); do echo "Diff from ${commits[i]} to ${commits[i+1]}:" git diff ${commits[i]} ${commits[i+1]} echo "-------------------------------------------" done else echo "No commits found for today." exit 1 fi
Then I just ran this:
./generate_diffs.sh | pbcopy
which copies the resulting diffs to the clipboard. Then, you can do whatever you want with it and create a report based on the changes today. You could filter the time window and authors in a different way and make reports for different strata.
We might talk about that later.
We use cookies to improve your experience and analyze our traffic. By using our site, you consent to our use of cookies. You can manage your preferences below: