list-youtube: Delete `height` and `filesize` columns from output
[sunny256-utils.git] / git-logdiff
blobc93a8b0c8f0e81c93d6ff6b3e286d816cd4d22b4
1 #!/usr/bin/env bash
3 #=======================================================================
4 # git-logdiff
5 # File ID: b51c5d58-5406-11e0-a9ae-552d51fb27db
6 # Compare two different Git histories. Syntax:
7 # git logdiff <commit1> <commit2> [rootcommit]
8 # License: GNU General Public License version 2 or later.
9 #=======================================================================
11 test "$1" = "-p" && { p_str=-p; shift; }
12 ext=.git-logdiff.$(date +%s).$$.tmp
13 c1=$(git log -1 --format=format:%h $1)
14 c2=$(git log -1 --format=format:%h $2)
15 if test -n "$3"; then
16 mbase="$3"
17 else
18 mbase="$(git merge-base $c1 $c2)"
20 c1=$mbase..$c1
21 c2=$mbase..$c2
22 git log --raw --format=raw $p_str $c1 >/tmp/$c1$ext
23 git log --raw --format=raw $p_str $c2 >/tmp/$c2$ext
24 vimdiff /tmp/{$c1,$c2}$ext
25 rm /tmp/{$c1,$c2}$ext