When making changes to a block of code or block of text, I frequently just comment out the code and rewrite it anew. I might copy-paste existing code (just to avoid stupid transcription errors). If its too large to see both what I'm writing, and the old code, at the same time, I just use two windows on the same file. This is relevant to writing fiction or non-fiction as well. For example, I didn't like this, so I com…
Huh, I thought your first example was much more poetic. The vaguely run-on sentence does a much better job of evoking what's happening in the scene.
Why is it so hard to see code from 5 minutes ago?
351–360 of 424 posts
Re: Why is it so hard to see code from 5 minutes ago?
#352Earlier quoted context omitted.
I do the same. Many people comment about commiting frequently but that doesn't work for me: delete code + commit => I don't see the code anymore and my brain magically forgets about it. I need the quick feedback loop: commented code + uncommented code (all in one screen) => new code is going to look like a mix of both. If I have to use git to see commented code then the feedback loop is broken.
Commiting frequently also has a substantial cost of needing to think of a commit message. If you don't think of a commit message, you'll never be able to find this version again. If you think up a message every 2 minutes, you'll quickly find you spend more time thinking of commit messages than writing code. I wish there was some kind of auto generated commit message. Things like: "Added function xyz()" or "Adjusted c…
Or you can just not care. 99% of the value of your git repo should be in the most recent commit.
Re: Why is it so hard to see code from 5 minutes ago?
#353I didn't even realize I did this until reading this article. I think the issue is that the undo/redo concept is inadequate. The author's solution of a persistent, read-only history seems like a step in the right direction, but that seems like it's much too slow of a workflow to beat out CTRL+Z/Y/Shift+Z, which is muscle memory for most. Maybe we need something like a hyper lightweight git that can be controlled via k…
Re: Why is it so hard to see code from 5 minutes ago?
#354Earlier quoted context omitted.
"Sounds like trial and error" Isn't that what coding is?
Maybe to some extent, but most of coding in my experience is planning things out, figuring out exactly what you're trying to do and then just writing it. Bug fixes have a bit more trial and error to them obviously, but it's usually not reading entire code blocks. If some function becomes too gordian I start working on a refactoring branch to fix it. I also use 2+ monitors so I experience very little of the code delet…
Re: Why is it so hard to see code from 5 minutes ago?
#355Earlier quoted context omitted.
You can assign a custom shortcut to it via Settings > Keymap and then the action "Main Menu > File > Local History". I myself have assigned the shortcut control+shift+=
Thanks, did that. I decided on Alt+Z, because Ctrl+Z is Undo, so I though this makes sense.
Re: Why is it so hard to see code from 5 minutes ago?
#356Why is that a problem? Just commit, as many times as you want, to a throwaway branch.
Re: Why is it so hard to see code from 5 minutes ago?
#357I didn't even realize I did this until reading this article. I think the issue is that the undo/redo concept is inadequate. The author's solution of a persistent, read-only history seems like a step in the right direction, but that seems like it's much too slow of a workflow to beat out CTRL+Z/Y/Shift+Z, which is muscle memory for most. Maybe we need something like a hyper lightweight git that can be controlled via k…
Re: Why is it so hard to see code from 5 minutes ago?
#358Earlier quoted context omitted.
I write a lot of frontend JS with hot reloading make change => see result => cmd-z 1 time to fix result OR commit and keep coding oops, it wasn't really fixed. cmd-z 3 times and see if that works I know it's wrong, but what's right?
> I know it's wrong, but what's right? Nah, it's not wrong. You're testing your code changes live.
(I know you're joking)
Re: Why is it so hard to see code from 5 minutes ago?
#359When making changes to a block of code or block of text, I frequently just comment out the code and rewrite it anew. I might copy-paste existing code (just to avoid stupid transcription errors). If its too large to see both what I'm writing, and the old code, at the same time, I just use two windows on the same file. This is relevant to writing fiction or non-fiction as well. For example, I didn't like this, so I com…
How do you comment things out in the "English fiction/non-fiction" programming language?
Re: Why is it so hard to see code from 5 minutes ago?
#360Earlier quoted context omitted.
> Also the second rendition makes doesn't include what the rest of the joggers are doing ... Something is amiss here.
Karma/backlash for my rude post. I will leave it unedited, but s/makes// in case it is not clear.