mirror of
https://github.com/ViViDboarder/shoestrap.git
synced 2024-11-24 12:06:30 +00:00
40 lines
826 B
Bash
Executable File
40 lines
826 B
Bash
Executable File
#! /bin/bash
|
|
|
|
##########################
|
|
# Author: ViViDboarder
|
|
# Returns a git log of any commits in the current or given month
|
|
##########################
|
|
|
|
month=$1
|
|
year=$2
|
|
|
|
if [ -z "$month" ]; then
|
|
echo "usage: git-monthly <month> <year>"
|
|
echo "eg: git-monthly 4 2019"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "$month" == "" ]]; then
|
|
# Get the current month
|
|
month=$(date "+%m")
|
|
fi
|
|
|
|
if [[ "$year" == "" ]]; then
|
|
# Get the current year
|
|
year=$(date "+%Y")
|
|
fi
|
|
|
|
# Get the next month
|
|
if [[ "$month" == "12" ]]; then
|
|
# If December, loop to Jan of next year
|
|
nmonth="1"
|
|
nyear=$((year + 1))
|
|
else
|
|
# Otherwise, next month of this year
|
|
nmonth=$((month + 1))
|
|
nyear=$year
|
|
fi
|
|
|
|
# Get the git log between the target month and the next month
|
|
git log --before="{${nyear}-${nmonth}-1}" --after="{${year}-${month}-1}"
|