Last active
April 12, 2016 17:10
-
-
Save pikender/1afed1280dc693be88b285de02233b27 to your computer and use it in GitHub Desktop.
Easy way to generate diff b/w commits for a range while sharing blog post
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
#!/usr/bin/env bash | |
if [[ $# -eq 2 ]] ; then | |
echo "Start Commit: $1\nEnd Commit: $2" | |
else | |
>&2 echo "Usage: DRY_RUN=1 $0 [Start-Commit] [End-Commit]\nExample: $0 d2b931acb891d74014d2c5f6a1996f69c222e01c 5c3b13ad8e0c4cf742adc990593926eb25d36fcd" | |
exit 1 | |
fi | |
echo "Is Dry run ?? $DRY_RUN" | |
start_commit=$1 | |
end_commit=$2 | |
local_start_commit=$start_commit | |
for i in `git log --reverse $start_commit...$end_commit | grep commit | cut -d ' ' -f2- | xargs`; do | |
echo pretty-diff $local_start_commit...$i | |
if [[ "$DRY_RUN" -eq 1 ]]; then | |
echo gist-diff $local_start_commit...$i | |
else | |
gist-diff $local_start_commit...$i | |
fi | |
local_start_commit=$i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment