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:

https://github.com/libgit2/libgit2/blob/5aee96329ab7869cbe90cf80fd2a3f8f4dc5dccf/include/git2/branch.h

  • git doesn't auto commit when I pull
  • Merge Pull Request Manually
  • git: change origin of cloned submodule
  • Git rebase interactive the last n commits
  • Accidentally created a git submodule
  • How do I use git diff -G?
  • 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.

  • src refspec master does not match any when pushing commits in git
  • git mergetool reports “No files need merging”
  • “Invalid project description”, importing from GIT repo problem
  • Publishing to CocoaPods from Travis
  • Local Git branch has diverged from origin following an interactive rebase
  • List all commits (across all branches) for a given file
  • 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: .../gitweb.cgi/<repo>/<action>/<revision>:/<path>?<arguments>

    Here <revision> may be symbolic, e.g. HEAD; I suppose you can use commit hashes and tags, too.

    Obviously GitHub uses a different URL mapping.

    Note that 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.

    Git Baby is a git and github fan, let's start git clone.