Skip to content

Commit

Permalink
limit output to 10 last branches; configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsir committed Feb 28, 2024
1 parent 0997659 commit 7ab8271
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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=()
Expand Down

0 comments on commit 7ab8271

Please sign in to comment.