Skip to content

Commit 89bcc3a

Browse files
This document helps use parse our git commits so we
can make them more easily readable and clickable in our Readme.
1 parent 285d142 commit 89bcc3a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

parse_git_log.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'''
2+
This document helps use parse our git commits so we
3+
can make them more easily readable and clickable
4+
in our Readme.
5+
'''
6+
7+
import os
8+
import datetime
9+
import git # pip install GitPython
10+
11+
12+
repo = git.Repo(os.getcwd())
13+
14+
master = repo.head.reference
15+
16+
with open("parsed_log.md", "w+") as parsed_log:
17+
for commit in master.log():
18+
if "commit" in commit.message:
19+
commit_mess = commit.message.replace("commit: ", "").replace("commit (initial): ", "")
20+
line = "[{message}](../../tree/{commit}/)".format(message=commit_mess, commit=commit.newhexsha)
21+
parsed_log.write(line)
22+
parsed_log.write("\n\n")

0 commit comments

Comments
 (0)