Q: how can I get magit + ido to ignore tags when checking out a branch?

I'm using magit + ido. When I go to check out a branch, ido helpfully gives me the names of all existing branches, but it also gives me the names of all tags. Sometimes I want that, but usually I don't.

How can I convince magit + ido not to offer tags as a completion option?

1 Answer 1


You can control how refs are sorted with magit-list-refs-sortby, but Magit doesn't have a built-in option for excluding tags from the candidates listed by magit-checkout.

One way you could get this behavior is by overriding magit-checkout's interactive form, temporarily removing "refs/tags" from magit-list-refs-namespaces.

 'magit-checkout :around
 (lambda (f revision)
    (list (let ((magit-list-refs-namespaces
                 (remove "refs/tags" magit-list-refs-namespaces)))
            (magit-read-other-branch-or-commit "Checkout"))))
   (funcall f revision))
 '((name . "magit-checkout-notags")))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.