Even simpler by cloning into a new folder: $ git clone https://git.zx2c4.com/cgit . ... $ git submodule update --init --recursive Submodule 'git' (https://git.kernel.org/pub/scm/git/git.git) registered for path 'git' Cloning into '/git-cgit/git'... Submodule path 'git': checked out '69986e19ffcfb9af674ae5180689ab7bbf92ed28' Submodule 'sha1collisiondetection' (https://github.com/cr-marcstevens/sha1collisiondetection.git) registered for path 'git/sha1collisiondetection' Cloning into '/git-cgit/git/sha1collisiondetection'... Submodule path 'git/sha1collisiondetection': checked out '855827c583bc30645ba427885caa40c5b81764d2' $ git apply --verbose --check ../0005-git2.29.1.patch Checking patch Makefile... Checking patch git... $ git apply --verbose ../0005-git2.29.1.patch Checking patch Makefile... Checking patch git... warning: unable to rmdir 'git': Directory not empty Applied patch Makefile cleanly. Applied patch git cleanly. $ make ... $ make test ... SUBDIR tests ok 1 - extract Git version from Makefile not ok 2 - test Git version matches Makefile # # ( cat ../../git/GIT-VERSION-FILE || echo "No GIT-VERSION-FILE" ) | # sed -e "s/GIT_VERSION[ ]*=[ ]*//" -e "s/\\.dirty$//" >git_version && # sed -e "s/-/./g" makefile_version >makefile_git_version && # test_cmp git_version makefile_git_version # not ok 3 - test submodule version matches Makefile # ... The patch is attached (copied from first post) -- Jean-Christophe