Not on Git, but I was curious and grepped through the Siemens S7 repository I maintain at work; we've been using the same comment practice since forever, with the date in ISO8601 format. (Since before ISO 8601 even was a thing!)
Oldest I found?
1986-06-17: Trygve glemte å sjekke om vi deler på null. Fikset.
(Trygve forgot to check whether we divide by zero. Fixed.)
Yep. Huge limitation of this approach is the assumption the code has always lived in the same VCS. I remember migrating a monorepo for geointelligence processing algorithms years back to multiple repos, and its own history was it had been in Mercurial before Git, ClearCase before Mercurial, and God knows what earlier than that. But I was reviewing old Fortran code for handling specific vehicle missions and could see from the mission codes that some of these were satellites launched in the late 80s, so the code itself had to be even older than that.
Yes, your caveat is correct: it's possible that none of the lines present in your oldest commit have survived into the current head commit of your main branch.
Not sure how the article's algorithm deals with renames. If a file being renamed as a deletion and addition, then that conceals the age of the lines.
I like leaving something like gitlens on so I can see the super old lines ad-hoc when I naturally come across them. It's fun to get glimpses of the past.
It's probably almost always going to be a boring config line(s) in the initial commit?
A section header in a pylintrc or Cargo.toml, a Django settings.py var, etc. Or even an import/var in a file that's core enough to still exist, import logging and LOGGER = ... for example.
Sigh indeed... at a previous job there was a project that was a port of an Algol project that began in 1992. I have no idea what version control systems were used in its history (wouldn't be surprised if it started with no version control) but the last version control migration was from Team Foundation Service to GitHub and of course it was just a single commit of the then current master. 23 years of history gone.
Our code base still has ghost comments about code being just so because the NeXT compiler won't accept it any other way. No one has the heart to remove them.
I picked up a project from 1999 a few years ago that still had far pointer macros - I didn't think they were still a thing in 1999 so I'm not sure why they were there to start with. I think I've left them though.
In our monorepo (of 101470 Java files, according to
find . -name '*.java' | wc -l
), I shudder to think how long that would take. For large repos, I imagine you could get quite a bit faster by only considering files created before the oldest date you've found so far.
If any of the lines form the repo's first commit happen to be untouched, then that's a huge short-cut: those lines are the oldest. Finding one of those lines manually is a pretty easy task. Enumerating them all accurately, less so.
I ran into that too. Turns out that you need to add in the path you want to search when invoking the command. If it's your current working directory, use `.`
I wrote a similar maybe hacky script using `git blame` on every file. In our main application, we still have a couple lines from the initial commit in 2011.
For the codebase I was working on today (in C). At first it was just } so filtered those out, then it was /* (no comment detail on that line) so again filter them. Then it was a bunch of #includes.
Not surprising but not insightful at all unfortunately
Maybe a readme.md with the initial name, a license file, and a .gitignore file. Whatever it is that all repos would have regardless of the language or application type.
At $oldjob our Git repos had all been created by importing history from SVN, and that SVN repo had been created as an import from CVS, so there were some fairly old timestamps in the history. Only about a decade older than Git, though. Nothing from the era of SCCS or (bare) RCS.
[+] [-] lb1lf|1 year ago|reply
Oldest I found?
1986-06-17: Trygve glemte å sjekke om vi deler på null. Fikset.
(Trygve forgot to check whether we divide by zero. Fixed.)
[+] [-] nonameiguess|1 year ago|reply
[+] [-] loeber|1 year ago|reply
[+] [-] NoMoreNicksLeft|1 year ago|reply
[+] [-] akoboldfrying|1 year ago|reply
[+] [-] js2|1 year ago|reply
https://git-scm.com/docs/git-rev-list
https://git-scm.com/docs/git-ls-tree
https://git-scm.com/docs/git-show
https://git-scm.com/docs/git-cat-file
https://git-scm.com/docs/gitrevisions
[+] [-] kazinator|1 year ago|reply
Not sure how the article's algorithm deals with renames. If a file being renamed as a deletion and addition, then that conceals the age of the lines.
[+] [-] roetlich|1 year ago|reply
But... that's the point of this? Finding the initial commit is not nearly as fun as looking at the oldest code that is still running.
[+] [-] skeptrune|1 year ago|reply
[+] [-] cmgriffing|1 year ago|reply
[+] [-] lutherqueen|1 year ago|reply
for ext in $(git ls-files | grep -vE 'node_modules|\.git' | awk -F. '{if (NF>1) print $NF}' | sort -u); do echo -e "\n.$ext:"; git ls-files | grep "\.$ext$" | xargs -I {} git blame -w {} 2>/dev/null | LC_ALL=C sort -t'(' -k2 | head -n1; done
[+] [-] OJFord|1 year ago|reply
A section header in a pylintrc or Cargo.toml, a Django settings.py var, etc. Or even an import/var in a file that's core enough to still exist, import logging and LOGGER = ... for example.
[+] [-] lionkor|1 year ago|reply
[+] [-] hoten|1 year ago|reply
sigh..
[+] [-] krick|1 year ago|reply
[+] [-] jamesfinlayson|1 year ago|reply
[+] [-] verytrivial|1 year ago|reply
[+] [-] jamesfinlayson|1 year ago|reply
[+] [-] nortlov|1 year ago|reply
[+] [-] zellyn|1 year ago|reply
[+] [-] kazinator|1 year ago|reply
[+] [-] JensRantil|1 year ago|reply
[+] [-] js2|1 year ago|reply
https://news.ycombinator.com/item?id=42883340
[+] [-] jamesfinlayson|1 year ago|reply
[+] [-] pc86|1 year ago|reply
[+] [-] abejfehr|1 year ago|reply
[+] [-] spatten|1 year ago|reply
[+] [-] unknown|1 year ago|reply
[deleted]
[+] [-] donatj|1 year ago|reply
[+] [-] lionkor|1 year ago|reply
[+] [-] kridsdale3|1 year ago|reply
[+] [-] rozenmd|1 year ago|reply
Huh, TIL the birthdate of my business was actually a couple of days ago.
[+] [-] ceejayoz|1 year ago|reply
[+] [-] rdc12|1 year ago|reply
Not surprising but not insightful at all unfortunately
[+] [-] password4321|1 year ago|reply
[+] [-] francisofascii|1 year ago|reply
[+] [-] password4321|1 year ago|reply
https://stackoverflow.com/questions/77446305/what-are-the-be...
[+] [-] inglor_cz|1 year ago|reply
It is SVN, though, and not Git.
[+] [-] kridsdale3|1 year ago|reply
[+] [-] wiml|1 year ago|reply