Git. How to create archive with files, that have been changed?

后端 未结 3 617
后悔当初
后悔当初 2021-01-06 17:21

Keeping the file structure, like git-archive

3条回答
  •  猫巷女王i
    2021-01-06 17:49

    Courtesy of @Charles Duffy https://stackoverflow.com/users/14122/charles-duffy

    Thanks to @Viperet answer. Below is to insert a pause if you have a very long list files to be archived. Xargs will run the same command multiple time with split arguments hence it will always produce the archived zip with the last split arguments. To correct that, a quick workaround is to insert a pause in between.

    Again, it's a courtesy from Charles Duffy. XARGS Long Arguments and Pause Between Commands

    Updated command:

    git diff --name-only -z --diff-filter=ACMRT release..HEAD | xargs -0 bash -c '"$@"; sleep 10' _ git archive -o update.tar.gz HEAD
    

    Hope it helps others as well.

    Thank you,

    Hatjhie

提交回复
热议问题