From 7ab8271cd9bb80d2f928436faa60ac7bfc9d2b9d Mon Sep 17 00:00:00 2001 From: Adam Sir Date: Wed, 28 Feb 2024 11:28:36 +0100 Subject: [PATCH] limit output to 10 last branches; configurable --- .../git-checkout-interactive.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/git-checkout-interactive/git-checkout-interactive.plugin.zsh b/plugins/git-checkout-interactive/git-checkout-interactive.plugin.zsh index 9d99ce71c..58ff6bb26 100644 --- a/plugins/git-checkout-interactive/git-checkout-interactive.plugin.zsh +++ b/plugins/git-checkout-interactive/git-checkout-interactive.plugin.zsh @@ -3,9 +3,10 @@ ####################################### function git-checkout-interactive() { + local ITEMS_TO_SHOW=10 # Get all branches sorted by committer date, along with their last commit hash local branches - branches=$(git for-each-ref --sort=-committerdate --format='%(refname:short) %(objectname:short)' refs/heads/) + branches=$(git for-each-ref --count="$ITEMS_TO_SHOW" --sort=-committerdate --format='%(refname:short) %(objectname:short)' refs/heads/) # Parse branches local branch_list=()