From 98637db1b0bc63bf7247349be10215e31dd6e555 Mon Sep 17 00:00:00 2001 From: Chris Apple <14171107+cjappl@users.noreply.github.com> Date: Wed, 11 Jan 2023 10:50:41 -0800 Subject: [PATCH] Only show available cherry picks (#266) Only shows changes that are eligible for cherry-pick to the branch, not every commit. Also adds nice color to the output --- bin/git-forgit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/git-forgit b/bin/git-forgit index cf36b68e..421a5dc4 100755 --- a/bin/git-forgit +++ b/bin/git-forgit @@ -282,8 +282,8 @@ _forgit_cherry_pick() { --multi --ansi --with-nth 2.. -0 --tiebreak=index $FORGIT_CHERRY_PICK_FZF_OPTS " - fzf_selection=$(git cherry "$base" "$target" --abbrev -v | nl | _forgit_reverse_lines | - FZF_DEFAULT_OPTS="$opts" fzf | sort --numeric-sort --key=1 --reverse | cut -f2-) + fzf_selection=$(git log --right-only --color=always --cherry-pick --oneline "$base"..."$target" | nl | + FZF_DEFAULT_OPTS="$opts" fzf | sort --numeric-sort --key=1 | cut -f 2- | cut -c 1-8) fzf_exitval=$? [[ $fzf_exitval != 0 ]] && return $fzf_exitval [[ -z "$fzf_selection" ]] && return $fzf_exitval