Git commit logger for daily stand-up meeting At work, my team hosts a daily standup, in which we discuss what we're working on, what we did the day before and any potential blockers for future development.
I thought as a fun little side project that I would write a script in bash to go through each directory in my /dev/ folder and get all commits from the previous day.
We use Git for the most part, but I do have one or two repositories still under a different source control system. This code is to mitigate that problem 2&gt;&gt; /dev/null;.
Here is the code:
gitUsername=&quot;userNameHere&quot;
echo &quot;Here are yesterday's commits:&quot;

for dir in ./*/ ;
    do (cd &quot;$dir&quot;; git log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cD) %C(bold blue)&lt;%an&gt;%Creset' --since yesterday --author $gitUsername} 2&gt;&gt; /dev/null;);
done;

echo &quot;That's everything.&quot; 

I have never written anything in bash before, so any suggestions would be much appreciated!
Also, just a side note in case anybody is interested, we don't read commits to measure workload, I am printing them more as a reminder of the things I was working on the day before.
A much much much much better way of doing this is:
find . -type f -exec git --no-pager log --pretty=format:'%Cred%h%Creset -%Creset %s %Cgreen(%cD) %C(bold blue)&lt;%an&gt;%Creset' --since yesterday {} --author $gitUsername \;
And a cleaner way to write long statements it to add '\' to break into new lines.
find . -type f \
-exec git --no-pager log --pretty=format: \
'%Cred%h%Creset -%Creset %s %Cgreen(%cD) %C(bold blue)&lt;%an&gt;%Creset' \
--since yesterday {} \
--author &quot;${gitUsername}&quot; \;

This way, 7 lines are written as 1 and to stdout.

--no-pager returns everything to your terminal stdout instead your editor.
find . says which directory to search in, so a for loop may be useful to only search desired directories
Also, explicitly defining the desired dirs will remove the need to redirect to stderr and when useful errors are displayed, will be meaningful to you.

https://linux.die.net/man/1/find
https://www.golinuxcloud.com/find-exec-multiple-commands-examples-unix/