I wrote Emacs Script to Review Git Status of Repositories 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 usingmagit-list-repositories
which shows projects name, version, status (untracked, unstaged, staged) and numbers of unpushed/unpulled commits from upstream. Very convenient. AlsoC-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:
Name | Version | D | ⇣ | ⇡ | Branch | Path |
---|---|---|---|---|---|---|
dotzshrc | 20210802.2144-g9155fd9 | 0 | 0 | main | ~/git/dotzshrc/ | |
sipity | 20210802.0852-g2ecdaa4 | 0 | 0 | main | ~/git/ndlib/sipity | |
hyrax | 20210731.1844-g3d92137 | 0 | 0 | main | ~/git/samvera/hyrax | |
hugo-tufte | 20210731.1839-gfef60e9 | 0 | 0 | main | ~/git/takeonrules.github.io/themes/hugo-tufte | |
takeonrules.github.io | 20210802.1134-gc84acbf6 | N | 0 | 0 | trunk | ~/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.