4

is there any way to fetch only history? Sometimes repositories are big and it takes very long period of time to download it.

I don't need a files, i just need to look for commits history with git log and git show.

Mistalis
  • 17,793
  • 13
  • 73
  • 97
  • What do you mean by "fetch only commits history"? How is this different from what Git does by default? (Consider: If you can look at a repository's history you have the contents of every revision.) – ChrisGPT was on strike Dec 17 '16 at 14:17

2 Answers2

2

No if you want to see all the history locally, you will need to clone all changes.
You just can do so in a bare repo (git clone --bare) in order to not checkout the default branch HEAD.

But that won't mean downloading less data: only a shallow clone would download less, but that would mean a partial history.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

No you can't.

In Git repositories, commits and files are managed separately. So it should be possible to implement a feature to fetch only commits, but such a feature is not implemented yet.

Note that a commit in a repository includes only information git show -q <commit> shows. So, if such a feature would be implemented, you can't see diffs or so in a repository fetched by the feature.

kaitoy
  • 1,545
  • 9
  • 16