In Git you don’t have to actually commit, you can use the staging area. It’s something I do rather often. I’m going to make a non-trivial change and I’m not sure if it’s the right approach, so I `git add -A` first, make my change, and then `git diff —-cached` to review it. This is especially useful when doing things like running formatting tools, so I can see what the tool just did. And it doesn’t require making any…
Are you suggesting that people make commits before reviewing the changes? I never thought of that...
Why is it so hard to see code from 5 minutes ago?
201–210 of 424 posts
Re: Why is it so hard to see code from 5 minutes ago?
#202Re: Why is it so hard to see code from 5 minutes ago?
#203Earlier quoted context omitted.
As an aside, I think I wouldn't mind if a programming language would include two commenting syntaxes, one for ordinary comments, and another for commenting out. These are two very different use-cases, and distinguishing them syntactically might facilitate certain kinds of work-flows.
In C, you can wrap the 'commented' code with #if 0 ... #endif
#if 1
....new code...
#else
....old code...
#endif
Esp. for tricky stuff, it's then possible to just flip the 1/0 to easily test/compare/profile the new/old code.Some IDE's will even work out which block of code to colour and which to dim.
Re: Why is it so hard to see code from 5 minutes ago?
#204Re: Why is it so hard to see code from 5 minutes ago?
#205> Want to know what we saw developers doing instead? They either duplicate code files or took screenshots of relevant code while in the middle of a change. Even I have done something similar before: I'm about to mess this up... I'll Ctrl-A and Ctrl-V this into a new tab before it gets too messy, and then I can put the window beside my editor to use as a reference. I even observed a professional developer with 20 year…
I made a similar comment and now I recognize that what we’re doing is branching outside version control. And I also recognize it’s still sensible to do, and that to the extent version control feels like friction this is yet another case where the interfaces to it aren’t good enough. And I don’t just mean “git cli is a bad ux” (though I mean that also), but that the whole world of version control is poorly serving rap…
because of this comment I just decided to create a keyboard shortcut for commits to be alt+cc so now it's a little easier, I still need to type a commit message and accept save and stage, but at least it's all doable from the keyboard.
Re: Why is it so hard to see code from 5 minutes ago?
#206For me "Local History" feature in WebStorm solves the issue. https://www.jetbrains.com/help/webstorm/local-history.html
Re: Why is it so hard to see code from 5 minutes ago?
#207Commit often and use reflog?
Re: Why is it so hard to see code from 5 minutes ago?
#208For me "Local History" feature in WebStorm solves the issue. https://www.jetbrains.com/help/webstorm/local-history.html
Re: Why is it so hard to see code from 5 minutes ago?
#209Jetbrains IDEs have a local history feature that provides snapshots with diffs and allows partial rollbacks. I only use it when experimenting with different approaches. Mostly I only use the "Local Changes" tab in the Git panel that shows the diff compared to the last commit, or "Compare with branch" to see the overall changes relative to the base branch.
Re: Why is it so hard to see code from 5 minutes ago?
#210> Memo is an operation-based version control system that tracks changes at the level of individual keystrokes and synchronizes branches in real time.
[1] https://github.com/atom-archive/xray [2] https://github.com/atom-archive/xray/tree/master/memo_core
So, it would fix this problem, and also enable real-time collaborative editing, had it been completed.