News for hackers. Stuff that matters.
Re:Why is it so hard to see code from 5 minutes ago? by de6u99er on Thursday February 18, 2021 @09:11PM (#26188690)
I learned very early in to "Commit early, commit often!"

That 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? by ggpp on Thursday February 18, 2021 @10:18PM (#26189214)
> I believe many devs are afraid someone could see all their trial and error attempts and judge them

This is certainly part of the reason I do it. Sometimes I'll start repos anew, without the "mistake" commits and branches, and add that version to my Github before I send the link to a potential employer.

Re:Why is it so hard to see code from 5 minutes ago? by Jtsummers on Thursday February 18, 2021 @10:33PM (#26189321)
https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History

https://git-scm.com/docs/git-merge

C-f squash

You can compress a series of commits into one with squash in git.