Improve gitrecap

This commit is contained in:
2022-06-13 15:22:56 +02:00
parent ebbe573f95
commit d0a87a7963

View File

@ -1,5 +1,26 @@
#!/usr/bin/env fish
set MY_LATEST_COMMIT (git log --author "joakim@hulthe.net" --pretty=format:%H | head -n 1)
if set -q argv[1]
set N $argv[1]
else
set N 1
end
git diff $MY_LATEST_COMMIT
function nth_commit -a n
git log --author "joakim@hulthe.net" --pretty=format:%H \
| head -n $n \
| tail -n 1
end
set DIFF_FROM (nth_commit $N)
set DIFF_TO "HEAD"
if test $N -gt 1
set DIFF_TO (nth_commit (math $N - 1))"~1"
end
#echo "git diff"
#echo " $DIFF_FROM"
#echo " $DIFF_TO"
git diff $DIFF_FROM $DIFF_TO