I have set magit-repositories-directory like this:

(setq magit-repository-directories
      `("~/go/src/github.com/cescoferraro" ,user-emacs-directory))

Then I can M-x magit-list-repositories RET and I get a nice list containing all Git projects inside that folder.

Issue 1

I get Name, Version, L<U, U>L and Path columns.

But what does L<U, U>L mean? I get 0 values for only random repos. I could not figure out what it means. Ideally I want to know if there is something modified that needs to be pushed and if there is something at origin that needs to be pulled.

Issue 2

I want to use this as a sync tool. So I want to be able to push/pull and open magit-status for each project as I browse the list.

1 Answer 1



L for "local branch" has since been renamed to B for "branch": https://github.com/magit/magit/commit/cfb2b57bfb0e7ac8ded90bc57c4952612c1edd4b

Issue 1

  • B<U is calculated by the function magit-repolist-column-unpulled-from-upstream, which inserts the number of upstream commits not in the current branch.
  • B>U is calculated by the function magit-repolist-column-unpushed-to-upstream, which inserts the number of commits in the current branch but not its upstream.

In other words, a nonzero value in either column means the local branch and its upstream are out of sync. You can sort the *Magit Repositories* buffer (and other tabulated lists in Emacs) by placing point in the desired column and invoking M-x tabulated-list-sort (default key binding S). Alternatively, you can call this command with a numeric prefix N in order to sort the Nth column, or click the corresponding column header with the mouse.

You can customise the name, width, contents, and alignment of the columns displayed in *Magit Repositories* via the variable magit-repolist-columns, which see. For example, to add a column in the third position indicating uncommitted changes (see comments below), you could do:

(setq magit-repolist-columns
      '(("Name"    25 magit-repolist-column-ident ())
        ("Version" 25 magit-repolist-column-version ())
        ("D"        1 magit-repolist-column-dirty ())
        ("B<U"      3 magit-repolist-column-unpulled-from-upstream
         ((:right-align t)
          (:help-echo "Upstream changes not in branch")))
        ("B>U"      3 magit-repolist-column-unpushed-to-upstream
         ((:right-align t)
          (:help-echo "Local changes not in upstream")))
        ("Path"    99 magit-repolist-column-path ())))

You could achieve the same thing without having to redefine the whole list like so:

(with-eval-after-load 'magit-repos
  ;; Avoid destructively modifying a list literal.
  (let ((cols (copy-sequence magit-repolist-columns)))
    (push '("D" 1 magit-repolist-column-dirty ())
          (nthcdr 2 cols))
    (setq magit-repolist-columns cols)))

Of course, you could also skip having to write this Elisp yourself and just use the customisation interface (M-x customize-group RET magit-repolist RET), but where's the fun in that? ;)

Issue 2

You can open magit-status for each repository listed in *Magit Repositories* by typing M-x magit-repolist-status (default binding C-m or RET) on the corresponding line. Batch operations like pulling are deliberately not implemented in Magit, but are simple enough to write on your own; see https://github.com/magit/magit/issues/2971. You could hack mapping something like magit-pull-from-pushremote over all entries in the list, for example.

Issue 3

Note that populating the user option magit-repository-directories with strings instead of (DIRECTORY . DEPTH) cons cells was only supported for backward compatibility, and the obsolete fallback variable magit-repository-directories-depth has since been removed. I recommend you restructure your setting as:

(setq magit-repository-directories
      `(("~/go/src/github.com/cescoferraro" . DEPTH1)
        (,user-emacs-directory              . DEPTH2)))

where DEPTH1 and DEPTH2 are the respective maximum depths to look for Git repositories, as documented by the variable magit-repository-directories.

  • 1
    To clarify: I am pretty sure that L and U stand for Local and Upstream, which may help clarify their meaning. If you find this confuses you, just customise magit-repolist-columns.
    – Basil
    May 9, 2017 at 22:22
  • See relevant Magit feature request
    – Basil
    May 9, 2017 at 22:33
  • 1
    You may also be interested in this useful feature.
    – Basil
    May 9, 2017 at 22:35
  • You are a legend. But my setup is broken, Thats the whole cause of the issues. Neither C-m nor RET fire magit-repolist-status. I using evil and evil-magit. Is there a magit-repolist-hook I can set this manually? Concerning the issue 3, I figure DEPTH = 1 is ok if I do not use submodules right?
    – CESCO
    May 10, 2017 at 12:16
  • 1
    @CESCO Yes, just look at the variable's documentation (C-h v magit-repolist-columns). The second element of each element of magit-repolist-columns represents a column width.
    – Basil
    May 11, 2017 at 12:34

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.