dura
dura copied to clipboard
`dura checkout` command
This isn't one that should be tackled until the branch changes (#9 & related) I reckon, but a command to instantly checkout a backup would be very powerful. This could potentially be coupled with a dura restore
which merges/rebases/whatever a backup to the current branch.
Immediate thoughts are the command should take fixed and relative times, and round (up/down?) to the nearest backup. This would make it easy to find/recover a last known working version.
dura checkout 1h # check out backup from an hour ago
dura checkout 2022-01-10T17:00 # check out backup from timestamp
I really like the idea !
This makes sense, and I like your proposal. If I dura checkout 4h
immediately followed by dura checkout 3h
, I get mostly the same result as if I had done dura checkout 3h
to begin with. Seems intuitive.
Is checkout
the right name though? I think of it as a reset
. What do you think?
I'm thinking checkout
quite literally just checks out the commit/branch (perhaps in a detached state if it's a commit, I can't remember how Git works...) and doesn't affect your main branch at all. There would be a second command that builds on it called restore
or reset
which actually affects the main branch.
I see. I suggest another command that resolves a commit by these same time-based rules, so you could do git log $(dura resolve 4h)
. Basically a dry run version of this.
We could also imagine having stuff like dura diff 4h
etc etc...
I'd rather wait to build lots of sugar until we get a better feel for how people will use dura. I'm in favor of the the checkout & reset commands because they consolidate a fairly long list of commands that many Git users can't do off hand.