-2

My project is in many GBs. All I need is git log . Ideally it should suffice for me if I can just fetch the .git folder which tracks the versions.

ishandutta2007
  • 16,676
  • 16
  • 93
  • 129
  • That is exactly what is copied when you fetch from or clone a repo. – eftshift0 Dec 18 '18 at 00:20
  • then where does the contents of files come from ? – ishandutta2007 Dec 18 '18 at 00:21
  • From checking out master or whatever branch is checked out. Then the tree associated with the version you are checking out is expanded (from the DB of objects that was fetched) into your working tree – eftshift0 Dec 18 '18 at 00:23
  • I don't need to check out `master or whatever branch` – ishandutta2007 Dec 18 '18 at 00:25
  • Let alone unchanged files, I don't even need the information found in `git diff`, I just need `git log` for which contents of file are not needed. I dont need any information inside any files whatsoever. – ishandutta2007 Dec 18 '18 at 00:26
  • Hey, no spamming.... you asked a question, I'm giving you the answer, even to the point of explaining where all the files came from when you check out. I _guess_ (not sure, but I guess it's technically possible by using `git fetch some-remote object-id` perhaps with an option to ask to only fetch that object and not continue recursively) that you could ask to fetch a single revision object (the tip of a branch, say), analyze its parents and then continue pulling revision objects recursively. That way you might avoid pulling file/tree information. – eftshift0 Dec 18 '18 at 00:37
  • ... not sure if by pulling all those revisions objects you will be able to use git log, though. – eftshift0 Dec 18 '18 at 00:40

1 Answers1

0

You can do this with git clone --bare <repo>

ack_inc
  • 1,015
  • 7
  • 13
  • 3
    Yes, but it's important to note that the `.git/` folder isn't just metadata—it also contains the repository's full history. Every version of every file. If the repository is many gigabytes the `.git/` folder probably is too. – ChrisGPT was on strike Dec 18 '18 at 00:58
  • 1
    but the size being cloned is still the same (in many GBs for my case) – ishandutta2007 Dec 18 '18 at 01:56
  • @ishandutta2007, the problem is that you've asked two different questions. "Only the metadata" and "the version tracking folder" are different things. ack_inc has answered the second part correctly. I think your core misunderstanding is to think that you can do `git log` without having a copy of the repository. You can't. – ChrisGPT was on strike Dec 18 '18 at 14:14
  • @Chris: Yes that's my understanding, It would be great if you can elaborate and help me understand. – ishandutta2007 Dec 18 '18 at 16:08
  • @ishandutta2007, I'm not sure what more there is to say. The `.git/` directory contains the entire history of a repository, not just metadata. It can be used to hydrate a working copy from any commit, branch, or tag that exists in the repo. It therefore must necessarily contain the contents of every committed version of every file. There is no way to just clone metadata. The accepted answer on the duplicate question talks about `ls-remote`, but I don't think that helps you. I think you'll just have to put up with the size of the repo. – ChrisGPT was on strike Dec 18 '18 at 16:49