On Mon, Sep 17, 2018 at 08:41:36PM +0200, Duy Nguyen wrote: > > I think the reflog approach has been successful: give these intermediate > > states a name. So in theory I could do something like: > > > > git checkout -p :@{2.minutes.ago} > > > > though it would probably be useful to be able to walk the states, too, > > just like we have "log --reflog-walk". > > > > The syntax above is off-the-cuff (and based on the ":<stage>" index > > syntax). I guess if we had a separate log for "stuff in the worktree > > that got thrown away by reset" we might need a separate syntax. > > I'm leaning towards reflog too. Not because of the syntax but because > of reusing the current code base. I don't have to worry about pruning, > walking, gc-ing... because it's pretty much already there. And the UI > is not so urgent since reflog file is very readable, early adopters > can just open the file and get the hash. Ah, good point on pruning/gc. I had imagined a new "index log" format. But really if you just turn the result into a tree, then it becomes just another ref(log). That might be slightly less efficient, but the flexibility and simplicity are probably worth it. Or maybe with cache-tree it is not even less efficient. So that definitely seems like the right direction. > I'm trying to quickly make something that writes to > "$GIT_DIR/logs/index" and see how it goes. But yeah I'll probably drop > this patch. The ":@{2.minutes.ago}" just makes me like this direction > more, even though I don't know if I could even make that work. I think "index@{2.minutes.ago}" would almost work, but it would probably complain about a reflog without a matching ref. That seems like it would be pretty easy to work around in the reflog code. Or maybe even by having a stash-like "index log" ref. -Peff