added plugin to create git changelog and formatted code

pull/1816/head
Gurkirat Singh 2020-12-27 23:59:16 +05:30 committed by Noah Gorny
parent 1fbd91ebf9
commit 92d814b2f6
1 changed files with 238 additions and 203 deletions

View File

@ -273,3 +273,38 @@ function gitignore-reload() {
echo >&2 "Files readded. Commit your new changes now."
fi
}
function git-changelog(){
about 'Creates the git changelog from one point to another by date'
group 'git'
example '$ git-changelog origin/master...origin/release [md|txt]'
if [[ "$1" != *"..."* ]]
then
echo "Please include the valid 'diff' to make changelog"
return 1
fi
local NEXT=$(date +%F)
if [[ "$2" == "md" ]]
then
echo "# CHANGELOG $1"
git log $1 --no-merges --format="%cd" --date=short | sort -u -r | while read DATE ; do
echo
echo "### $DATE"
GIT_PAGER=cat git log --no-merges --format=" * (%h) %s by [%an](mailto:%ae)" --since="$DATE 00:00:00" --until="$DATE 24:00:00"
NEXT=$DATE
done
else
echo "CHANGELOG $1"
echo ----------------------
git log $1 --no-merges --format="%cd" --date=short | sort -u -r | while read DATE ; do
echo
echo [$DATE]
GIT_PAGER=cat git log --no-merges --format=" * (%h) %s by %an <%ae>" --since="$DATE 00:00:00" --until="$DATE 24:00:00"
NEXT=$DATE
done
fi
}