[cmake-developers] git equivalent to 'svn cat'

Brad King brad.king at kitware.com
Tue Sep 14 14:23:09 EDT 2010


On 09/14/2010 01:22 PM, James Bigler wrote:
> I'm trying to produce the equivalent command of 'svn cat' in git. 
> According to some documentation I'm supposed to be able to use git show:
> 
> http://git.or.cz/course/svn.html
> 
> You can see the contents of a file, the listing of a directory or a
> commit with:
> 
> git show /rev/:/path/to/file/           svn cat /url/
> git show /rev/:/path/to/directory/   svn list /url/
> git show /rev                           /svn log -r/rev/ /url/
>                                             svn diff -c/rev/ /url/
> //
> I don't seem to be able to produce the correct rev:path/to/directory
> necessary to make it work, however.
> 
> $ git show HEAD:git://cmake.org/cmake.git/Modules
> <http://cmake.org/cmake.git/Modules>
> fatal: Not a git repository (or any of the parent directories): .git

Git operations work locally.  Only special operations, "clone", "fetch",
"push", and a couple others work with remote repositories.  You cannot
use a URL with other commands.

You can do this:

  git show HEAD:Modules/readme.txt

where 'HEAD' can be any locally available commit.  See

  git help rev-parse

for help on "SPECIFYING REVISIONS".

-Brad



More information about the cmake-developers mailing list