From d87201c7b95cd3b89665b4074c3c67f38e7eb376 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Wed, 10 Jul 2019 11:21:21 +0800 Subject: gitconfig: Add 'ref-next' and 'log-next' aliases The 'ref-next' alias determines the *next* commit hash for the given commit. Credit: * Referening the child of a commit https://stackoverflow.com/a/21032988 * Git alias with positional parameters https://stackoverflow.com/a/3326971 --- _gitconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/_gitconfig b/_gitconfig index 06237b0..880b03d 100644 --- a/_gitconfig +++ b/_gitconfig @@ -38,6 +38,10 @@ # Show space and tabs wsErrorHighlight = all +[alias] + ref-next = !sh -c 'git log --ancestry-path --format=%H ${1:-HEAD}..master | tail -n 1' - + log-next = !git ref-next $1 | xargs git log + # Large file storage [filter "lfs"] clean = git-lfs clean -- %f -- cgit v1.2.2