Using Magit Built-in Functions for Workflow

Improving on a Hacked Together Function Using Magit

I wrote for creating a checklist of repositories to review. Over on /r/emacs, someone provided the following:

Similar to that, one can define magit-repository-directories which is a list of folders for magit to look for git projects - including an optional integer per each representing how deep to search. After you do that you can get a status overview using magit-list-repositories which shows projects name, version, status (untracked, unstaged, staged) and numbers of unpushed/unpulled commits from upstream. Very convenient. Also C-u magit-status lets you jump to one of these repositories using auto-complete.

Curious, I spent a bit of time exploring the Magit 🔍 function route, and settled on the following configuration:

(setq magit-repolist-columns
      '(("Name"    25 magit-repolist-column-ident ())
        ("Version" 25 magit-repolist-column-version ())
        ("D"        1 magit-repolist-column-dirty ())
        ("⇣"      3 magit-repolist-column-unpulled-from-upstream
         ((:right-align t)
          (:help-echo "Upstream changes not in branch")))
        ("⇡"        3 magit-repolist-column-unpushed-to-upstream
         ((:right-align t)
          (:help-echo "Local changes not in upstream")))
        ("Path"    99 magit-repolist-column-path ())))
(setq magit-repository-directories
      `(
        ("~/git/takeonrules.github.io/themes/hugo-tufte" . 1)
        ("~/git/takeonrules.github.io/" . 1)
        ("~/git/dotzshrc/" . 1)
        ("~/git/ndlib/sipity" . 1)
        ("~/git/samvera/hyrax" . 1)))

Now when I run M-x magit-list-repositories I get the equivalent buffer:

Table 225: Results of custom M-x magit-list-properties
NameVersionDBranchPath
dotzshrc20210802.2144-g9155fd9 00main~/git/dotzshrc/
sipity20210802.0852-g2ecdaa4 00main~/git/ndlib/sipity
hyrax20210731.1844-g3d92137 00main~/git/samvera/hyrax
hugo-tufte20210731.1839-gfef60e9 00main~/git/takeonrules.github.io/themes/hugo-tufte
takeonrules.github.io20210802.1134-gc84acbf6N00trunk~/git/takeonrules.github.io/

If there’s a non-blank in D column then there’s changes to commit. The column shows me what’s upstream that I don’t have locally. And the column shows me what I have locally that I haven’t pushed upstream.

And from the above buffer, I can quickly open a magit-status buffer to begin commiting changes and synchronizing repositories.

So with that, I can get an overview of all of the relevant repositories and take action accordingly. This supplants jnf/git-data-statuses function.