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.
Why is it so hard to see code from 5 minutes ago?
41–50 of 424 posts
Re: Why is it so hard to see code from 5 minutes ago?
#42If looking at a source browser of a previous version of your code is not adequate to understanding how it worked, such that you wish to "rewind" to that version and run it, then your code is very poorly written. It is indeed difficult sometimes to understand our own code some time after it is written, but by following good practices (ideally functional, with mostly pure functions), it should be readable. I will ventu…
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.
Re: Why is it so hard to see code from 5 minutes ago?
#43Does 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
EDIT: And of course I read the article after reading the comments.. Haha, VS Code plug-in in 3.. 2..
Re: Why is it so hard to see code from 5 minutes ago?
#44Re: Why is it so hard to see code from 5 minutes ago?
#45If looking at a source browser of a previous version of your code is not adequate to understanding how it worked, such that you wish to "rewind" to that version and run it, then your code is very poorly written. It is indeed difficult sometimes to understand our own code some time after it is written, but by following good practices (ideally functional, with mostly pure functions), it should be readable. I will ventu…
Are you certain the requirements can always be met without complexity? Have you ever had to build an os kernel, a database, an mmorpg server, a realtime 3d game engine, a production compiler, jit, or garbage collector?
And sure, it may be long ago, but I have some code in a AAA game. Even C++ with hundreds (*edit) of files, we got along just fine without rewind.
Re: Why is it so hard to see code from 5 minutes ago?
#46I am very surprised by this. I seldom use the control-z shortcut and I've been writing code for several decades...
Re: Why is it so hard to see code from 5 minutes ago?
#47For 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.
Re: Why is it so hard to see code from 5 minutes ago?
#48That being said, I don't think the reasons viven are honest: > When asked why they did this, they revealed they were trying to view some intermediate state of the code in the middle of a change.
Looking at some GitHub repos, with one single commit, I believe many devs are afraid someone could see all their trial and error attempts and judge them.
I oersonally am too lazy for the undo redo nonsense. Many of my final commits are mostly cleaning up the code. E.g. Refactoring so my code is like reading a story.
I don't have an issue with people thinking I have OCD or something similar. My bigger issue is if I ever have to touch my code again, to waste time on trying to understand it. Or even worse, someone else not understanding it and asking me for help.
Re: Why is it so hard to see code from 5 minutes ago?
#49Earlier quoted context omitted.
Yeah and it’s actually decent. That being said I don’t mind committing often. If I have a slew of small commits I squash them. Since I will need to commit at some point, I rather do it incrementally.
Committing removes the diff view in PyCharm, and I can't lose that. By "diff view" I mean I can see all the changes I've done from the main branch.
Re: Why is it so hard to see code from 5 minutes ago?
#50Are most modern developers struggling to write code without this? If so, there is a fundamental problem that has nothing to do with levels of undo.