Back Original

A Note About Git Worktrees

It turns out that git worktree makes working on your Emacs config much more convenient. Don't you hate it when you're editing your config, and you don't notice that you messed it up until you restart Emacs, and it doesn't start?

As it turns out, it's easy to move those changes off to a temporary directory if you're tracking your config directory in git.

  git stash
  git worktree add /tmp/that-edit-i-just-had-to-make
  cd /tmp/that-change-i-just-had-to-make
  git stash pop

Now, restart Emacs and it will restart from the working config on the clean HEAD, since git stash was called, and it's possible to run emacs --init-dir /tmp/that-change-i-just-had-to-make --debug-init to see the error, whilst using the working copy of Emacs to edit and fix the configuration (in /tmp).

Just remember that if you are following my example exactly, that /tmp gets cleared on reboot.