git repository browsing

两盒软妹~` 提交于 2019-12-23 02:38:10

问题


I am interested if I can do repository browsing with git in the following way:

given a remote repository -fetch only data about the directory structure of a certain revision at the beginning - fetch files individually on choice given the knowledge acquired previously

for example(fake commands only to illustrate intent):

git clone --dont_get_me_repo_contents_please // the info about the file contents is somewhere and i see my/cool/file alongside with others git get my/cool/file

Supposedly I would not be owning that server (the one were the remote repo is stored). I can only interact with it through the git client.

I just want to use as little network transfer as possible and as little space.

Basically, what you do on github, when you look through the files of a revision, and you see the dirs, you click on a file and you get just those contents. The only info that gets sent over the network is the dir structure and the contents of the file you are looking at. I'm assuming it is interacting with the git repo on the server. now how does it do that?

I do not want something that does this, maybe just as an example,I want to know how this is done.

I've done some reading and I feel the answer is no, this cannot be done in this form. Is it the case that one cannot do this and one needs a checked out revision somewhere? If so, what are my best alternatives, given my objectives (use as little network traffic as possible, secondary - try to minimize space as well).

I'm sorry if my use of git terms is abusive (n00b here). I hope I got the idea across.

EDIT: What about MERCURIAL? can these things be done with it?

Thanks.


回答1:


You could start with a shallow git clone (say, only 1 revision in the history):

git clone --depth 1


来源:https://stackoverflow.com/questions/12082909/git-repository-browsing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!