Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cloning / Reading only history /log of a git repository

Tags:

git

Within a localy cloned git repository i can watch the history with

git log

In a small tool i do only need the history of a repository, not the code. Is there a way to clone a repository without the code (history only) ?

Is there any other way to get the history only from a git repository.

Thanks in advance

like image 749
Boas Enkler Avatar asked Apr 23 '14 19:04

Boas Enkler


2 Answers

Clone the repository with the --bare flag:

git clone --bare ...

A "bare" repository in Git just contains the version control information and no working files (no tree) and it doesn't contain the special .git sub-directory. Instead, it contains all the contents of the .git sub-directory directly in the main directory itself.

Read more in the documentation on it, or this helpfull page about setting up server environments using the option.

like image 134
CodeManX Avatar answered Sep 24 '22 01:09

CodeManX


If you only want to view the history, you can use the partial clone feature with filtering out the blobs(file contents).

git clone --filter=blob:none YOUR_GIT_URL

Ref:

  1. git clone --filter
  2. Get up to speed with partial clone and shallow clone
like image 22
Yong Avatar answered Sep 21 '22 01:09

Yong