From 1c0fa15c88ab473b23b531a87671313ec0e9dbc6 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Mon, 26 Apr 2021 11:37:01 +0100 Subject: `git landed` command --- bin/git-landed | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/git-landed diff --git a/bin/git-landed b/bin/git-landed new file mode 100755 index 0000000..78c0e8d --- /dev/null +++ b/bin/git-landed @@ -0,0 +1,22 @@ +#!/bin/bash + +# shows the commit that "landed" a branch on HEAD +# +# git landed $commit-on-branch [ $head-to-land-on ] [ git-log options ] + +declare -a revs +declare -a flags + +for p in "$@"; do + if [[ $p =~ ^- ]]; then + flags+=( "$p" ) + else + revs+=( "$p" ) + fi +done + +there="${revs[0]:?need a commitish}" +here="${revs[1]:-HEAD}" + +git log "$here" ^"$there" --ancestry-path --merges --reverse -z "$flags" \ + | head -z -n 1 -- cgit v1.2.3