How can I use git-archive to include submodules from a bare repository

前端 未结 5 1091
南方客
南方客 2020-12-14 02:07

I\'m in the process of setting up a deployment script. The basic process is:

  1. Push changes to a bare repository on the server
  2. Then based on new tags wi
5条回答
  •  悲&欢浪女
    2020-12-14 02:35

    Here it is as a few-liner:

    prefix=$(basename "$(pwd -P)")
    {
      git ls-files
      git submodule foreach --recursive --quiet \
                    'git ls-files --with-tree="$sha1" | sed "s#^#$path/#"'
    } | sed "s#^#$prefix/#" | xargs tar -c -C.. -f "$prefix.tar.xz" --
    

提交回复
热议问题