Skip to content

Improve performance of git clone

Currently, we are performing a full clone. This is time and disk-space consuming for our users who have large Git repositories with a long history.

We need to analyse the possible options:

  • getting all the branches git clone --depth 1 --no-single-branch
  • getting a specified branch git clone --depth 1 --branch <MY_BRANCH>, the branch being defined by the ref input of actions/checkout@v2 or by an environment variable (this would remove the need for our users to write a hook); it unspecified, the default branch is retrieved
  • treeless --filter=tree:0 or blobless --filter=blob:none, but I quickly tested with Bitbucket, it does not support these, a full clone is performed

to select one and to implement it.

Edited by Laurent Mazuré