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.)
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.
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.
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.
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.
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.
yeah... wasn't me that did it though. Same group of people did it with a git repository they "recreated" more recently. They just don't know how to software.
I got my hands on the old SVN but it's a few TBs and so I had some trouble unzipping it. Maybe someday I'll patch a branch for blame archeology.
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.
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.
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.)
Incredible. This is like Graffiti from Pompeii.
Ugh. That is sooo Trygve.
You've got me beat... at a previous job, there were comments from 1991 complaining about how it was ported/rewritten from cobol.
Ported to what?
You don't need to blame every file. Use `git rev-list` to find your oldest commit.
That's it. Now you have the commit whose tree contains your oldest files. Now use: To see a particular file: Caveat: I suppose this doesn't account for files which no longer exist or that have been completely re-written.https://git-scm.com/docs/git-rev-list
https://git-scm.com/docs/git-show
https://git-scm.com/docs/git-cat-file
https://git-scm.com/docs/gitrevisions
Similar oneliner to paste on MacOS terminal and get the eldest line for each file extension:
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
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.
You underestimate the amount of software that starts with CRUFT
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.
Take my upvote :)
In our monorepo (of 101470 Java files, according to
), 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.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.
I imagine future engineers as archaeologists of software development, in a way, digging through ghost comments like fossils in the code.
future engineers? archaeology is an essential part of virtually every real-world software project
Not sure why all the lines of code. This is much shorter:
(on MacOSX)Get in the habit of using `ls-files -0` and `xargs -0` to prevent surprises. But there's no need to blame every file:
https://news.ycombinator.com/item?id=42883340
Hm, tried this on a Mac but something must be askew - it returned a commit by me in 2022 in a repo that has existed since at least 2017.
Formatting strikes again
Thanks. Fixed.
"Initial Commit", 9 years ago (transfered an at-the-time 15 year old SVN repo)
sigh..
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.
FWIW, when I ported SVN repos at work, I converted the commit history as well.
we hired contractors to move us from source gear to git and they said "moving the history would be too hard, so we didn't"
lost probably 10+ years of history
Renaming the company is also fun when its name is used for folders / package paths. The history isn't lost, just unusable.
There are a million files in the Meta monorepo starting with FB. I don't think they even changed the practice.
You see, the “fb” in fbcode stands for “fierce & beautiful”.
facepalm
yeah... wasn't me that did it though. Same group of people did it with a git repository they "recreated" more recently. They just don't know how to software.
I got my hands on the old SVN but it's a few TBs and so I had some trouble unzipping it. Maybe someday I'll patch a branch for blame archeology.
doesn't seem to work on macOS, I get:
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 `.`
At my old job, I remember it was some time at the beginning of the 1990s. I was born like 8 years after the code I was working on was written.
Oldest file I ever had to fix was the same age as me: 1986. Found a bug in 2013. Timezone math.
> README.md 2021-01-28 17:27:57 +1100
Huh, TIL the birthdate of my business was actually a couple of days ago.
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.
I suspect it'll be index.php's <?php line, lol.
Always start your git repos with an empty commit, right?
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.
Sep 30, 2008 at 5:03:58pm, revision 1.
It is SVN, though, and not Git.
What if my repo is older than git?