Skip to content

Instantly share code, notes, and snippets.

@palaniraja palaniraja/out.html
Last active Mar 12, 2019

Embed
What would you like to do?
Find all the files changed between two commits and cumulated commit messages per file
<html><head><style>td{white-space: pre;}</style></head><body><table border=1>
<tr>
<td>File: (file1.txt)</td>
<td>
5755793 commit from master (correct this time)
322afb2 file 1 modified, and to be tagged as v1
</td></tr>
<tr>
<td>File: (file2.txt)</td>
<td>
696e761 SHOULD NOT BE LISTED IN SCRIPT YYYYYYYYYYYY
d03794c file2 edited and file3 deleted
</td></tr>
<tr>
<td>File: (file3.txt)</td>
<td>
2f05397 file3 deleted finally in master branch
1f82866 file3 added after v2 tagged
d03794c file2 edited and file3 deleted
</td></tr>
<tr>
<td>File: (file4.txt)</td>
<td>
37c0754 multiline commit message line #1 multiline commit message line #2 multiline commit message line #3 multiline commit message line #4
67aa4b2 feature branch added and file4 commited
</td></tr>
<tr>
<td>File: (file5.txt)</td>
<td>
36c8a98 file5 added in newfile
</td></tr>
</table></body></html>
#!/usr/bin
echo "Usage: $0 startCommitSHA startCommitSHA\n\n"
outputFile="out.html"
rm $outputFile && touch $outputFile
# 3b9aea39c7..37c07544408b
echo "Start from Commit SHA: $1\n"
echo "End at Commit SHA: $2"
`echo "<html><head><style>td{white-space: pre;}</style></head><body><table border=1>" >> $outputFile`
git log --pretty='format:' --name-only $1..$2 | sort -u | while read line
do
if [ -n "${line}" ]; then
`echo "<tr>" >> $outputFile`
`echo "<td>File: ($line)</td>" >> $outputFile`
`echo "<td>" >> $outputFile`
git log --pretty=oneline --abbrev-commit $1..$2 -- $line >> $outputFile
`echo "</td></tr>" >> $outputFile`
# --all --full-history
fi
done
`echo "</table></body></html>" >> $outputFile`
echo "\n\nSaved to $outputFile"
@palaniraja

This comment has been minimized.

Copy link
Owner Author

palaniraja commented Mar 12, 2019

Sample output from my test reppo





File: (file1.txt)
--------------------------------------------

9ccb648 Merge branch 'feature'
5755793 commit from master (correct this time)
5354e0d Revert "commit from master"
55a9c46 commit from master
322afb2 file 1 modified, and to be tagged as v1
3b9aea3 file1, file2 and file3 added




File: (file2.txt)
--------------------------------------------

d03794c file2 edited and file3 deleted
3b9aea3 file1, file2 and file3 added




File: (file3.txt)
--------------------------------------------

2f05397 file3 deleted finally in master branch
1f82866 file3 added after v2 tagged
d03794c file2 edited and file3 deleted
3b9aea3 file1, file2 and file3 added




File: (file4.txt)
--------------------------------------------

37c0754 multiline commit message line #1 multiline commit message line #2 multiline commit message line #3 multiline commit message line #4
67aa4b2 feature branch added and file4 commited

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.