Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
292 views
in Technique[技术] by (71.8m points)

Browse and display files in a git repo without cloning

Is there a way to browse and display files in a git repo without cloning it first? I can do those in svn using the commands:

svn ls /path/to/repo 
svn cat /path/to/repo/file-in-repo

I can supposedly use git show but doing:

git show /path/to/repo
git show HEAD:/path/to/repo

result to

fatal: Not a git repository

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The command you want is git ls-remote which allows you to get some information about remote repositories, but you cant show history or list directories or anything of that level: essentially it only lets you see the remote objects at a very high-level (you can see the current HEADs and tags for example).

The only real way to do what you want (if I understand correctly) would be to use ssh to run a remote command and return the results, for example:

ssh me@otherhost "cd repo && git log -n 10"

What you want would be lovely functionality if they could add it, but from what I read it's not very easy since getting history etc needs a lot of information to be local to git, and at that point you may as well have done a git fetch.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...