Live data from Hacker News

Ask HN: Do you ever truly use your revision history?

news.ycombinator.com

121–130 of 287 posts

Re: Ask HN: Do you ever truly use your revision history?

#121
post #96

All the time! Two weeks ago I found something in a critical library at work (that ~every single C++ binary we run depends on: our main implementation of our custom threads' executor API) that made no sense. I couldn't understand why a variable was being rounded before being passed down to a lower layer, in a way that introduced an average 0.5 Ms of latency to many operations (I estimate that at peak, just one of the…

Your first example hits the nail on its head. I use code history all the time to understand the context in which a bug or weird looking piece of code was introduced. If the developer who wrote it isn't around anymore, or can't remember the details, then this information is really crucial to gain confidence that changing or removing the code won't just introduce another obscure bug because you didn't understand the reasoning behind it.

Re: Ask HN: Do you ever truly use your revision history?

#122
I do, I think. I often blame individual lines to see if there's information in the commit about the reason for the change. It's often straightforward to understand what's happening when reading code, the information that's often missing is the why.

Sometimes there are clues sometimes not, but you can often see the line change in the context of changes to other files and that can help.

For this reason I tend to make quite verbose commits with the context of why I'm making the change. A comment in the code would go out of date, and pollute readability, but a well written commit can be very useful.

Re: Ask HN: Do you ever truly use your revision history?

#123
It's crazy how in agreement we are that keeping our records is important for legal defense, debugging, auditing, finding out how things came to be etc

Then for our users it's like you can have one name and one name only if you change it, it's going to be that name forever in the past too

Tables should have revisioning on as a default

Re: Ask HN: Do you ever truly use your revision history?

#124
post #19

Frequently. Just this evening I was looking in the HN repository for the last version of the code that pg wrote, to remind myself how he used to do something. One of my favorite tricks is to make a file out of all the changes in the history: git log -p > bigass and then grep through the file (edit: which I like to do in Emacs—hence the file) to see every appearance of some construct. There's a lot of knowledge in the…

I find the temporarily localized documentation idea quite interesting – anyone else here tried that?

> Such an approach only works if your system is small,

I see no reason why this wouldn't scale if you (and other people working on the same codebase) just maintain individual branches (say "dang-braindump"). Just do exploratory/documentation work on that and cherry-pick, rebase -i or git merge --ff --squash --no-commit to skip the reverts.

Re: Ask HN: Do you ever truly use your revision history?

#125

I do, I think. I often blame individual lines to see if there's information in the commit about the reason for the change. It's often straightforward to understand what's happening when reading code, the information that's often missing is the why. Sometimes there are clues sometimes not, but you can often see the line change in the context of changes to other files and that can help. For this reason I tend to make q…

That's indeed useful, some IDEs/editors are able to show the commit message just above the line of code you're looking at, providing a lot of useful context when troubleshooting. Of course it does require discipline on our part, as it can fall over when a dev has been through hours of messages like "trying something..."

Re: Ask HN: Do you ever truly use your revision history?

#126

We just switched from Perforce to git at work, and about the first 2/3 of a project I work on got squashed together. It took me less than a week to bump in to that "initial commit" when trying to figure out why a bit of code is the way it is. "git blame" (or the p4 equivalent) is my usual archaeologic tool in this context, but "git bisect" has been very helpful in others. For the first, it should be easy to look at y…

I'm in a similar boat with you, so I have a few questions:

1. Why did you switch? Are you satisfied with the new experience?

2. Why was some of the history needed to be squashed? Were there any technical concerns?

Re: Ask HN: Do you ever truly use your revision history?

#127
Not frequently, as some other commenters have claimed to do. But when I do, it's invaluable.

I build custom automation equipment, which involves individual 100-400 hour projects. They're developed in a continuous scratch-to-complete flurry, with a few days of revision after customer review and installation, a year's warranty that typically involves 1-5 on-site days, and an annual "we never read the manual please remind us how to calibrate it again" for the next decade. Very little maintenance coding, lots of fresh feature development.

I disagree that there's diminishing value to older commits. You're more likely to forget what you did the farther back you go!

I'd estimate that I use revision history maybe 0-2 times in a typical project. But that's an easy way to recover a couple days of work that would otherwise need to be rewritten from memory, or worse, reengineered from scratch! You can write a lot of commit messages in 16 hours, so one incident where you can recover two days of work makes two months of using version control without ever referencing the history worth it. Plus, it's a nice security blanket for me, I don't worry about commenting around old code or making changes to a reference implementation I'm modifying because I know it will be in version control.

I do think it's exceedingly unlikely that you'll suddenly decide to revert to the state of your codebase from 20 years ago. If you transitioned to Git and kept the SVN repository around for the rare occasion when you need to reference it, at least in my projects, you'd be able to do so without much trouble.

Re: Ask HN: Do you ever truly use your revision history?

#128
I was recently trying to link our source code against a newer version of LLVM that had introduced a few API changes that I couldn't make heads or tails of. Without the git log I would've had to manually compare the changes and figure out what they meant, or just guess. But luckily the commit messages quite clearly explained what changed in most cases.

Re: Ask HN: Do you ever truly use your revision history?

#129
Hell yes, I use it daily. I'm in AAA gamedev and the codebase I deal with goes back 20+ years. The last 10 years are readily accessible in Perforce and the rest can be found in another version control system. I am forever grateful to past engineers for outlining WHY they made their changes, and not WHAT the changes were per se. With thousands of engineers that have come and gone, this is incredibly useful information in addition to the code itself.

IMHO revision history is just as valuable to a company as the code itself.

Re: Ask HN: Do you ever truly use your revision history?

#130
Source control history is absolutely essential for me for debugging hard-to-reproduce bugs. The first step is a blame (both git and svn have this) to find out when the last changes to a suspicious piece of code happened and what has changed. Also who changed it so I know who to talk to (if they are still in the company). If the commit comment gives additional info, why the change happened that's great.

Sometimes those changes are over a decade old (of course such old changes make it more unlikely that they are still buggy, but new changes may interact with those old changes in unexpected ways).

So yes, the older a code base, the more important a complete change history becomes.

Post reply on HN