I’m wondering if there’s a better way to check out the initial version of a file than the obvious way:
git log --reverse [path/to/file]
copy the first sha1
git checkout [found sha1] [path/to/file]
We’ve got HEAD for the most recent, and the ^ suffix for going back one(or more) but I’ve not seen any good way to go back to the beginning.
Well, you ought to use command substitution:
but there’s not going to be anything fundamentally simpler. Git tracks content, not files, so it has no record of “version one of file A” – walking the history’s the way to find it.
I took out the
--reverseto make the command shorter – it doesn’t actually speed things up to use it, because internally, it just finds everything and reverses before printing out, instead of printing as it goes.If it’s something you do a lot (though I have no idea why you would) you could alias it.