Does git provide a URL scheme for directly referencing a version of a file?
Is there some sort of URL scheme for git that allows you to directly reference a particular file in a version? Example:
In this URL we have basically [protocol]://[repo location]/blob/[version hash]/[file path]
I’m assuming this link scheme is something GitHub made up, and not something that could be used anywhere else. Given that, is there anything similar I could use on non-GitHub implementations of git? something like:
git://[repo location]/[version hash]/[file path] ?
I know I could programmatically look it up given the version hash and file path, but I’m more interested in the easy referential abilities a URL provides.
2 Solutions collect form web for “Does git provide a URL scheme for directly referencing a version of a file?”
gitweb supports the following scheme, per the man page:
<revision> may be symbolic, e.g.
HEAD; I suppose you can use commit hashes and tags, too.
Obviously GitHub uses a different URL mapping.
git-daemon speaks its own protocol, and
git-http-backend does not seem to serve individual files; there’s no ‘native’ URL scheme.
When you have a local repo:
git show [version hash]:[file path]
Note the colon.