Is it safe to shallow clone with –depth 1, create commits, and pull updates again?

The --depth 1 option in git clone:

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.

But I’ve successfully done a shallow clone, committed some changes and pushed those changes back to the (bare clone) origin.

It makes sense to me – I mean why not? when the cloned HEAD is identifiable in the origin, and my commit comes on top of this, there seems no reason. But the manual says otherwise.

I like the idea of shallow clone – e.g. of drupal core: there’s no way I need to know what went on in drupal 4 when I’ve started from 7. – but I don’t want to shoot myself in the foot.

So is it safe to shallow clone, develop commits in it, pull again to keep up with updates from origin?

2 Answers
2

Leave a Comment