ZijingWu
ZijingWu

Reputation: 3490

How to let the git not tracking the large file history?

We somehow have an third-party library which need to check-in to our git project. And the library update frequently.

After some time, seams the git becomes huge, and it take long time when we clone it. So is there any way to delete the old version of the library, and just keep the HEAD version for each branch, so we can reduce size and the time to clone this git repository.

Upvotes: 1

Views: 27

Answers (1)

JamesD
JamesD

Reputation: 2546

I believe that what you want is a shallow clone

git clone --depth 1

This will checkout the repo with only a single item of history.

If you want to specify the branch to use (instead of the default "master" branch) use this syntax (requires Git 1.9+):

git clone -b <remoteBranch> --single-branch --depth 1 ssh://[email protected]:serverport/PathToProject <FolderName>

Upvotes: 1

Related Questions