forked from ocaml-batteries-team/batteries-included
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more details on how to get a nice changelog out of git
- Loading branch information
Showing
1 changed file
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
Look in git log for list of changes | ||
Look in git log for list of changes. | ||
|
||
The command | ||
|
||
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative | ||
|
||
will print a nice change log showing commit ids like the following: | ||
|
||
* 9d571fc - (HEAD, v1.4.0) Bump version to 1.4.0 (11 minutes ago) | ||
* 0097761 - Merge in fixes from upstream camomile (8 days ago) | ||
* a29bb96 - v1.4.0pre2 (tweaks to _oasis) (2 weeks ago) | ||
* 1c65b81 - (github/v1.4.0) V1.4 iniital commit (2 weeks ago) | ||
* 8926634 - (github/master) Forgot Bat prefix on substring, compile fix (3 weeks ago) | ||
|
||
The following bash script generates a GNU-style ChangeLog file, if | ||
that's your thing. | ||
|
||
#!/bin/sh | ||
# Convert git log to GNU-style ChangeLog file. | ||
# (C) Chris | ||
if test -d ".git"; then | ||
git log --date-order --date=short | \ | ||
sed -e '/^commit.*$/d' | \ | ||
awk '/^Author/ {sub(/\\$/,""); getline t; print $0 t; next}; 1' | \ | ||
sed -e 's/^Author: //g' | \ | ||
sed -e 's/>Date: \([0-9]*-[0-9]*-[0-9]*\)/>\t\1/g' | \ | ||
sed -e 's/^\(.*\) \(\)\t\(.*\)/\3 \1 \2/g' > ChangeLog | ||
exit 0 | ||
else | ||
echo "No git repository present." | ||
exit 1 | ||
fi |