Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created July 3, 2023 18:42
Show Gist options
  • Save guitarrapc/36a7178cc80649ac3ea71c71e2d6963d to your computer and use it in GitHub Desktop.
Save guitarrapc/36a7178cc80649ac3ea71c71e2d6963d to your computer and use it in GitHub Desktop.
git clone + submodule clone with shallow-clone difference.
command clone depth submodule depth total sec
--depth + submodule --depth 1 1 125sec
--depth --single-branch + submodule depth 1 1 127sec
--depth --single-branch --recursive 1 1 109sec
--depth + submodule --depth 100 1 126sec
--depth --single-branch + submodule depth 100 1 114sec
--depth --single-branch --recursive 100 100 107sec
--depth + submodule --depth 100 100 102sec
--depth --single-branch + submodule depth 100 100 108sec

depth 1

# shallow: 103sec + 22sec
git clone --depth 1 https://github.com/Org/Repo
cd Repo
git submodule update --init --recursive --recommend-shallow --depth 1 

# shallow_singlebranch: 105sec + 22sec
git clone --depth 1 --single-branch https://github.com/Org/Repo
cd Repo
git submodule update --init --recursive --recommend-shallow --depth 1

# shallow_single_submodule: 109sec
git clone --depth 1 --single-branch --recursive https://github.com/Org/Repo

depth 100 + 1

# shallow: 104sec + 22sec
git clone --depth 100 https://github.com/Org/Repo
cd Repo
git submodule update --init --recursive --recommend-shallow --depth 1

# shallow_singlebranch: 92sec + 22sec
git clone --depth 100 --single-branch https://github.com/Org/Repo
cd Repo
git submodule update --init --recursive --recommend-shallow --depth 1

# shallow_single_submodule: 107sec
git clone --depth 100 --single-branch --recursive https://github.com/Org/Repo

depth 100 + 100

# shallow: 90sec + 12sec
git clone --depth 100 https://github.com/Org/Repo
cd Repo
git submodule update --init --recursive --recommend-shallow --depth 100

# shallow_singlebranch: 96sec + 12sec
git clone --depth 100 --single-branch https://github.com/Org/Repo
cd Repo
git submodule update --init --recursive --recommend-shallow --depth 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment