Live data from Hacker News

Why is it so hard to see code from 5 minutes ago?

web.eecs.utk.edu

51–60 of 424 posts

Re: Why is it so hard to see code from 5 minutes ago?

#52

Does anyone know if there’s a good way to do this in VS Code? I often hold cmd-z until I get to some version and copy code from it. Ideally I’d like to have a separate window where I can see a previous version without affecting the current file/view. Before anyone comments, git doesn’t cut it for this because no one commits after every -+1

Commit early, Commit often!

Re: Why is it so hard to see code from 5 minutes ago?

#53
post #46

I am very surprised by this. I seldom use the control-z shortcut and I've been writing code for several decades...

Indeed. This sounds more like trial-and-error programming.

Yes, and I've always believed that short-term memory is a very important mental training for a coder.

Re: Why is it so hard to see code from 5 minutes ago?

#54
post #42

Earlier quoted context omitted.

Nope. Sometimes I’m rewriting something and I just want to see what the old code looked like before I changed it. There’s nothing smelly about that.

That's what a git browser is for. It's not like your code is gone forever, unless you are undisciplined.

I certainly don’t commit things every five minutes, so this doesn’t help.

Re: Why is it so hard to see code from 5 minutes ago?

#57

For anyone that uses emacs, there is an excellent plugin "undo-tree" that solves this problem in a slightly different way. Everytime you undo a series of actions and then perform a new action, it creates a branch in the "tree". You can then visualize the tree and move through it quickly your entire buffer history.

Another cool thing about undo in Emacs is that it's context aware.

By default, you can select any block of text and the undo command will cycle through the changes only from that region of your buffer.

Re: Why is it so hard to see code from 5 minutes ago?

#59

For anyone that uses emacs, there is an excellent plugin "undo-tree" that solves this problem in a slightly different way. Everytime you undo a series of actions and then perform a new action, it creates a branch in the "tree". You can then visualize the tree and move through it quickly your entire buffer history.

Came here to post this. Tho most times my undo tree are single characters.
Post reply on HN