1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-08 16:30:40 +01:00

limit output to 10 last branches; configurable

This commit is contained in:
Adam Sir
2024-02-28 11:28:36 +01:00
parent 09976595be
commit 7ab8271cd9

View File

@@ -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=()