logo

drewdevault.com

[mirror] blog and personal website of Drew DeVault git clone https://hacktivis.me/git/mirror/drewdevault.com.git

Configuring-aerc-for-git.md (2444B)


  1. ---
  2. date: 2020-04-20
  3. layout: post
  4. title: Configuring aerc for git via email
  5. tags: ["workflow", "aerc", "git"]
  6. ---
  7. I use [aerc](https://aerc-mail.org) as my email client (naturally — I
  8. wrote it, after all), and I use [git send-email](https://git-send-email.io) to
  9. receive patches to many of my projects. I designed aerc specifically to be
  10. productive for this workflow, but there are a few extra things that I use in my
  11. personal aerc configuration that I thought were worth sharing briefly. This blog
  12. post will be boring and clerical, feel free to skip it unless it's something
  13. you're interested in.
  14. When I want to review a patch, I first tell aerc to `:cd sources/<that
  15. project>`, then I open up the patch and give it a read. If it needs work, I'll
  16. use "rq" ("reply quoted"), a keybinding which is available by default, to open
  17. my editor with the patch pre-quoted to trim down and reply with feedback inline.
  18. If it looks good, I use the first of my custom keybindings: "ga", short for git
  19. am. The entry in `~/.config/aerc/binds.conf` is:
  20. ```
  21. ga = :pipe -mb git am -3<Enter>
  22. ```
  23. This pipes the entire message (-m, in case I'm viewing a message part) into `git
  24. am -3` (-3 uses a three-way merge, in case of conflicts), in the background
  25. (-b). Then I'll use C-t (ctrl-T), another keybinding which is included by
  26. default, to open a terminal tab in that directory, where I can compile the code,
  27. run the tests, and so on. When I'm done, I use the "gp" keybinding to push the
  28. changes:
  29. ```
  30. gp = :term git push<Enter>
  31. ```
  32. This runs the command in a new terminal, so I can monitor the progress. Finally,
  33. I like to reply to the patch, letting the contributor know their work was merged
  34. and thanking them for the contribution. I have a keybinding for this, too:
  35. ```
  36. rt = :reply -Tthanks<Enter>
  37. ```
  38. My "thanks" template is at `~/.config/aerc/templates/thanks` and looks like
  39. this:
  40. ```
  41. Thanks!
  42. {% raw %}
  43. {{exec "{ git remote get-url --push origin;
  44. git reflog -2 origin/master --pretty=format:%h; }
  45. | xargs printf 'To %s\n %s..%s master -> master\n'" ""}}
  46. {% endraw %}
  47. ```
  48. That git command prints a summary of the most recent push to master. The result
  49. is that my editor is pre-filled with something like this:
  50. ```
  51. Thanks!
  52. To git@git.sr.ht:~sircmpwn/builds.sr.ht
  53. 7aabe74..191f4a0 master -> master
  54. ```
  55. I occasionally append a few lines asking questions about follow-up work or
  56. clarifying the deployment schedule for the change.