Emacs Script to Review Git Status of Repositories

Generating a Quasi-TODO List for a Common Mental Model Task

update: After some input on /r/emacs, I wrote . Those changes supplant what I’ve written below.

Throughout my day, I work on several different Git 🔍 repositories. And sometimes, I can lose track of what all I’ve worked on.

To help with this task, I created the following Emacs 🔍 variable and function to let me quickly and methodically check the status of those repositories.

;; This is a truncated list of my projects
(setq jnf/data-dirs

(cl-defun jnf/git-data-statuses (&optional (dirs jnf/data-dirs))
  "Review DIRS via `magit'.

By default the DIRS are `jnf/data-dirs'"
  (message "Review status of local git repos...")
    (dolist (path dirs)
      (if (f-dir-p (file-truename path))
          (magit-status path))))

When I execute the jnf/git-data-statuses command, Emacs opens one Magit 🔍 buffer for each of the git repositories in the jnf/data-dirs list. I then work through what I need to do for each git repository.

Below is an example of the magit-status buffer for the ~/git/takeonrules.github.io/ git repository:

Head:     trunk Publishing general update eg. no posts
Rebase:   origin/trunk Publishing general update eg. no posts
Push:     origin/trunk Publishing general update eg. no posts

Untracked files (1)

Unstaged changes (1)
modified   data/glossary.yml

From that buffer, I can perform the various git commands (e.g., stage all changes, commit the changes, push the branch). And when I’m done with that project’s buffer, I close it out and move on to the next project.