← Back to archive

Repo of the Day

tkellogg/dura

Published: Jan 4, 2022

Open repository ↗

You shouldn't ever lose your work if you're using Git

Summary

Dura is a Rust background process that watches your Git repositories and silently commits uncommitted changes to dedicated dura/* branches without touching HEAD, the index, or your current branch. The idea is to give you a recovery point for situations like editor crashes or destructive commands. Under the hood it uses libgit2, and the README says the tool has been in use since 2022-01-01 without major issues.

What it is useful for

Dura acts as an automatic safety net for engineers who forget to commit, lose work to a crashed editor, or run a command they immediately regret. Instead of relying on per-file undo history, you get a repo-wide timeline you can rewind through.

The project is useful for:

  • Catching uncommitted edits across a working tree without staging or committing.
  • Reverting a repository to a state from minutes or hours earlier without making throwaway commits.
  • Adding a backup layer on top of long-running refactors or experiments.

The README does not position it as a replacement for git stash, branches, or normal commits. It is a daemon you keep running in the background.

How engineers can use it

Install it through any of the documented paths. On macOS, brew install dura is the simplest and also sets up a launchctl service. On other systems, you can use cargo install dura, paru -S dura-git on Arch, or nix shell nixpkgs#dura. Building from source is cargo install --path . from a cloned checkout.

The day-to-day flow from the README is:

  1. Start the background process with dura serve &. The & is Unix shell background syntax; you can also leave the terminal open.
  2. Register each repository. You must cd into each one and run dura watch. The README notes that bulk registration is not yet built in and suggests a find one-liner as a workaround.
  3. Edit files as normal. You don't need to stage or commit. Dura polls roughly every 5 seconds and creates a new commit on the corresponding dura/<commit-hash> branch.
  4. To recover, list branches with git log --all or tig, then check out the desired commit. The branch tracking your current uncommitted state is dura/$(git rev-parse HEAD).
  5. Stop the daemon with dura kill from anywhere.

A documented limitation is that recovery still requires manual git reset and git checkout steps; the README links an issue inviting collaboration to make this easier. The repository's license field reads NOASSERTION on GitHub, so review the repo's terms before relying on it.