-
Notifications
You must be signed in to change notification settings - Fork 405
/
gen-changelog.sh
executable file
·70 lines (62 loc) · 2.11 KB
/
gen-changelog.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# This CHANGELOG script was originally based of the work of Andrey Nikishaev and Gunnar Lindholm from this post:
# http://stackoverflow.com/questions/7387612/git-changelog-how-to-get-all-changes-up-to-a-specific-tag
# This script is geared towards OSX and you will need GTAC installed.
# `brew install coreutils`
# The placeholders are:
# %H: commit hash
# %h: abbreviated commit hash
# %T: tree hash
# %t: abbreviated tree hash
# %P: parent hashes
# %p: abbreviated parent hashes
# %an: author name
# %aN: author name (respecting .mailmap)
# %ae: author email
# %aE: author email (respecting .mailmap)
# %ad: author date (format respects --date= option)
# %aD: author date, RFC2822 style
# %ar: author date, relative
# %at: author date, UNIX timestamp
# %ai: author date, ISO 8601 format
# %cn: committer name
# %cN: committer name (respecting .mailmap)
# %ce: committer email
# %cE: committer email (respecting .mailmap)
# %cd: committer date
# %cD: committer date, RFC2822 style
# %cr: committer date, relative
# %ct: committer date, UNIX timestamp
# %ci: committer date, ISO 8601 format
# %d: ref names, like the --decorate option of git-log(1)
# %e: encoding
# %s: subject
# %f: sanitized subject line, suitable for a filename
# %b: body
# %B: raw body (unwrapped subject and body)
# %N: commit notes
# %gD: reflog selector, e.g., refs/stash@{1}
# %gd: shortened reflog selector, e.g., stash@{1}
# %gn: reflog identity name
# %gN: reflog identity name (respecting .mailmap)
# %ge: reflog identity email
# %gE: reflog identity email (respecting .mailmap)
# %gs: reflog subject
repo_url="http://github.com/kandanapp/kandan/commit/"
echo "CHANGELOG"
echo "========="
git for-each-ref --sort='*authordate' --format='%(tag)' refs/tags |gtac |grep -v '^$' | while read TAG ; do
echo
if [ $NEXT ];then
echo "#### [$NEXT]"
else
echo "#### [Current]"
fi
GIT_PAGER=cat git log --pretty=format:" * [%h]($repo_url%h) %s __(%an)__" $TAG..$NEXT
NEXT=$TAG
done
echo ""
FIRST=$(git tag -l | head -1)
echo ""
echo "#### [$FIRST]"
GIT_PAGER=cat git log --pretty=format:" * [%h]($repo_url%h) %s __(%an)__" $FIRST