← blog.mackieburgess

Minimal note-taking with git

Taking notes using a text editor, git, and a shell alias.

Mackie Burgess · 2023-11-14

This is a neat little alias I’ve used before for taking notes with git:

export NOTES="$HOME/files/notes" # or whatever.
alias ngit="/usr/bin/git --git-dir=$NOTES/.git --work-tree=$NOTES"

Now ngit acts like git except relative to $HOME/files/notes, wherever you are. There’s also a bonus alias if you use a text editor you can call from the terminal:

alias note="$EDITOR $NOTES/new"

So long as you “Save As” you’ll be good, otherwise you’ll have a file called new which will be opened every time you call note. I also extended this for Vim-like editors:

alias note="$EDITOR \"+cd $NOTES\" \"+star\""

Lots of quote escaping makes this hard to read – here’s a rundown:


This notes solution is fine, but it’s really a jumping-off point for building little aliases which enrich the way you use the terminal, and help build a deeper understanding for how shell scripting works.

...Maybe I should make an alias blog-post 🤔