Dura: You mustn’t ever lose your work must you’re the utilization of Git

Dura: You mustn’t ever lose your work must you’re the utilization of Git

Dura is a background route of that watches your Git repositories and commits your uncommitted adjustments without impacting HEAD, most recent division
or the Git index (staged files). Even as you ever rating into an “oh snap!” dispute where you suspect you merely lost days of work, checkout a dura
division and recover.

Without dura, you exercise Ctrl-Z on your editor to rating attend to a upright utter. Thats’s so 2021. Computers smash, and Crl-Z handiest works on files
independently. Dura snapshots adjustments sooner or later of your whole repository as-you-stride, so that you should perchance maybe well well revert to “4 hours within the past” as a replace of “hit Ctrl-Z
like 40 cases or whatever”. At closing some sanity.

Straightforward suggestions to exercise

Launch the daemon:

The back can occur in any directory. The & is bash syntax to “daemonize” the technique, that diagram that you should perchance maybe well well launch dura and then
have interaction the utilization of the an identical terminal window while dura retains working. You’ll want to maybe well maybe additionally bustle dura back in a window that you have interaction open.

Let dura know which repositories to come sooner or later of:

$ cd some/git/repo
$ dura come sooner or later of

Upright now you’ll must cd into each and every repo that you in point of fact are in search of to come sooner or later of, one-at-a-time. Even as it’s essential to always have solutions on suggestions to realize this better, allotment them right here.

Make some adjustments. No must commit and even stage them. Insist any Git tool to hunt the dura branches:

dura produces a division for every right commit you assemble and makes commits to that division without impacting your working duplicate. You
have interaction the utilization of Git exactly like you did sooner than.

The dura division that is monitoring your most recent uncommitted looks to be like dura-f4a88e5ea0f1f7492845f7021ae82db70f14c725. In bash, you should perchance maybe well well rating the
division title through:

echo "dura-$(git log | head -n1 | awk '{ print $2 }')"

Insist git log or tig to make a choice out which commit you would favor to rollback to. Reproduction the hash and then bustle one thing like

# Or, must you assemble no longer belief dura yet, `git stash`
$ git reset HEAD --keen
# rating the adjustments into your working directory
$ git checkout $THE_HASH
# previous couple of instructions reset HEAD attend to master but with adjustments uncommitted
$ git checkout -b temp-division
$ git reset master
$ git checkout master
$ git division -D temp-division

Even as you are drawn to bettering this journey, collaborate right here.

  1. Set up rust (e.g. brew set up rustup)
  2. Clone this repository
  3. High-tail cargo set up --path .

Is that this steady?

It be mute in prototype segment. Start issues touching on steadiness are marked with the
steadiness tag.

How in overall does this test for adjustments?

Each and every so veritably, like 5 seconds or so. Internally there is a adjust loop that sleeps 5 seconds between loops, so it runs much less commonly than
every 5 seconds (doubtlessly plenty much less commonly, if there is quite just a few work to realize).

Does this work on my OS?

  • Mac: certain
  • Linux: doubtless
  • Windows: maybe

Join the pack! Join 8000+ others registered customers, and rating chat, assemble groups, put up updates and assemble pals around the globe!

Leave a Reply

2 thoughts on “Dura: You mustn’t ever lose your work must you’re the utilization of Git

  1. Aditya avatar

    Cool tool!

    It's kind of insane to that in 2022 were still dealing with "save early, save often."

    Our tools are so antiquated. Storage is cheap and computers are fast, every keystroke should be persisted somewhere I can recover from rather than having to manually save and commit works in progress.

  2. Aditya avatar

    Along similar lines, I've adopted a hyper-frequent commit pattern in git. I do a bunch of meaningless micro-commits as I'm making progress, and then rewrite them all into one or two meanginful commits once I've reached a working state of whatever I was trying to do.

    I find it's helpful for not losing work / easily backing up if as I'm going along I realize I want to change approach.

    (For the micro commit I have a git command "git cam" that just commits all changes with the message "nt". Then once I'm ready to do a "real commit", I have "git wip" which rolls back all the nt commits but leaves them in checkout; then I can make one or two "real" commits.)

    I wonder if dura would be even better, or if the commit frequency would end up being too fine-grained and obscure?