Ilias pointed to an interesting alternative which edk2 uses its git subtrees.
$ git log
commit 83488286d287e53fad1efbfe1d4f5dbf69202f4a (HEAD -> master)
Merge: 27b050e91d 120e0665c3
Author: Maxim Uvarov <
maxim.uvarov@linaro.org>
Date: Wed Aug 2 07:53:17 2023 +0000
Merge commit '120e0665c37ec69d46c10fc341e253ae2e69afca' as 'lib/lwip/lwip-external'
commit 120e0665c37ec69d46c10fc341e253ae2e69afca
Author: Maxim Uvarov <
maxim.uvarov@linaro.org>
Date: Wed Aug 2 07:53:17 2023 +0000
Squashed 'lib/lwip/lwip-external/' content from commit 84fde1ebbf
git-subtree-dir: lib/lwip/lwip-external
git-subtree-split: 84fde1ebbfe35b3125fc2d89b8a456cbacf148e9
So it actually plases code of lwip.git into a subdirectory as a git commit. When you do git clone then all sources will be fetched.
No need for any additional commands after that. I vote for subtree instead of plain code copy.
Maxim.