Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions git_weekly_report-v2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

current_day=$(date +%j)
authors=()


# uses days since Jan 1st
#command_output=$(git log --since="7 days ago" --pretty=format:"%an %ad" --date=format:"%j")

while read -a line; do
day=${line[-1]}
name=${line[0]}

if [[ $day -le $current_day ]]; then
authors+=("$name")
else
# converts back into human readable date
echo -n $(date -d "2026-01-01 +$(($day-1)) days" +"%Y-%m-%d") "- " " " "{#authors[@]}"
printf "%s\n" "${authors[@]}" | sort -u | tr '\n' ' '
echo
authors=()
fi
done < <(git log --since="7 days ago" --pretty=format:"%an %ad" --date=format:"%j")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have not covered the syntax for redirecting from a temporary file, but this is ok. It is not a mistake to use it, but in this situation a pipe | would have been more readable.

i.e. git log .. | while read -a line; do



echo -n $(date -d "2026-01-01 +$(($day-1)) days" +"%Y-%m-%d") "- "
printf "%s\n" "${authors[@]}" | sort -u | tr '\n' ' '
echo
Loading