CodinCat
CodinCat

Reputation: 15914

How can I keep git repository only 1 commit history?

Look at the diagram:

enter image description here

How can I approach this?

If I use pull, all the commit histories will be pull down.

I don't want the git histories to consume my server's disk space

Upvotes: 2

Views: 119

Answers (1)

Thanatos
Thanatos

Reputation: 44256

--depth:

git clone --depth <remote>

See man git-clone:

--depth <depth>

Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches.

I use this in exactly the case you describe, too, in fact, mostly for speed.

Upvotes: 4

Related Questions