Variable: magit-list-refs-sortby

magit-list-refs-sortby is a customizable variable defined in magit-git.el.

Value

nil

Documentation

How to sort the ref collection in the prompt.

This affects commands that read a ref. More specifically, it controls the order of refs returned by magit-list-refs, which is called by functions like magit-list-branch-names to generate the collection of refs. By default, refs are sorted according to their full refname (i.e., "refs/...").

Any value accepted by the --sort flag of "git for-each-ref" can be used. For example, "-creatordate" places refs with more recent committer or tagger dates earlier in the list. A list of strings can also be given in order to pass multiple sort keys to
"git for-each-ref".

Regardless of what is specified here, refs are first sorted by namespace, according to the order of magit-list-refs-namespaces.

Note that, depending on the completion framework you use, this may not be sufficient to change the order in which the refs are displayed. It only controls the order of the collection passed to magit-completing-read or, for commands that support reading multiple strings, read-from-minibuffer. The completion framework ultimately determines how the collection is displayed.

This variable was added, or its default value changed, in magit version 2.11.0.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defcustom magit-list-refs-sortby nil
  "How to sort the ref collection in the prompt.

This affects commands that read a ref.  More specifically, it
controls the order of refs returned by `magit-list-refs', which
is called by functions like `magit-list-branch-names' to generate
the collection of refs.  By default, refs are sorted according to
their full refname (i.e., \"refs/...\").

Any value accepted by the `--sort' flag of \"git for-each-ref\" can
be used.  For example, \"-creatordate\" places refs with more
recent committer or tagger dates earlier in the list.  A list of
strings can also be given in order to pass multiple sort keys to
\"git for-each-ref\".

Regardless of what is specified here, refs are first sorted by
namespace, according to the order of `magit-list-refs-namespaces'.

Note that, depending on the completion framework you use, this
may not be sufficient to change the order in which the refs are
displayed.  It only controls the order of the collection passed
to `magit-completing-read' or, for commands that support reading
multiple strings, `read-from-minibuffer'.  The completion
framework ultimately determines how the collection is displayed."
  :package-version '(magit . "2.11.0")
  :group 'magit-miscellaneous
  :type '(choice string (repeat string)))