tags:

views:

98

answers:

2
+3  Q: 

svn cat for git

I am looking for the equivalent of svn cat in git.

Yes, I am aware that the similar question was asked here. The answer is to use git show rev:path.

However, svn cat can be used for the remote repository. That is, I can do svn cat url@rev and get the file from the specified revision of the remote repository, without getting the whole repository. My understanding is that git show only applies to the local repository.

A workaround I found is to use gitweb interface to get the blob.

+1  A: 

In another thread it is mentioned that it is impossible to fetch a single file. So the only options are to either fetch the remote repository, or look at the file with another tool (like a web browser for example).

iwein
A: 

You are probably asking the wrong question. What is it that you want to achieve? Remember, git is a DVCS: each of us has his (her) own repository, and each person works solely on his own repository.

You know that in git "remote" means someone else, compared to Subversion where remote means a central server. So what you may be asking is "how do I view some else's version of a file?". You want to fetch his head and then show the object.

wilhelmtell
What I want to do is to fetch a single file without fetching a whole repository. Repositories can be very big. As I said in the post, gitweb provides that, but not git itself.
sanxiyn