Hello,

Martin Geisler <[email protected]> writes:

> Hi all,
>
> Does Magit have an option to sort branch names by the order they have
> been used?

No, not that I'm aware of.

>
> I'm using magit-ido-completing-read and as far as I can tell, the
> order of the branches is alphabetically. That is normally not such a
> big problem since typing a few characters narrows the list down.
> However, I recently started having both a "release-2.0" and a
> "release-2.1" branch in my repository -- and now find myself
> repeatedly typing "rel21" to pick the right one :-)
>
> Any hints on how to have the completion function order the branches in
> a smarter way?

Does sorting by the committer date get you the behavior you want?

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index af9134c..7af3975 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1012,6 +1012,7 @@ (defun magit-list-unmerged-to-upstream-branches ()

 (defun magit-list-refnames (&rest args)
   (magit-git-lines "for-each-ref" "--format=%(refname:short)"
+                   "--sort=-committerdate"
                    (or args magit-list-refs-namespaces)))

 (defun magit-list-branch-names ()
--8<---------------cut here---------------end--------------->8---

If so, you could create a feature request for this to be added as an
option.

--
Kyle

-- 
You received this message because you are subscribed to the Google Groups 
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to