dura icon indicating copy to clipboard operation
dura copied to clipboard

`dura checkout` command

Open JakeStanger opened this issue 3 years ago • 6 comments

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

JakeStanger avatar Jan 12 '22 21:01 JakeStanger

I really like the idea !

drupol avatar Jan 14 '22 09:01 drupol

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?

tkellogg avatar Jan 14 '22 15:01 tkellogg

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.

JakeStanger avatar Jan 14 '22 15:01 JakeStanger

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.

tkellogg avatar Jan 14 '22 15:01 tkellogg

We could also imagine having stuff like dura diff 4h etc etc...

drupol avatar Jan 14 '22 15:01 drupol

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.

tkellogg avatar Jan 14 '22 15:01 tkellogg