git-archive a subdirectory --

前端 未结 1 1869
囚心锁ツ
囚心锁ツ 2020-12-09 03:09

I\'m using git-archive to archive a subdirectory in a git repo, like so:

git archive -o ../subarchive.zip HEAD subdir/*

However the resulti

相关标签:
1条回答
  • 2020-12-09 03:31

    You can do that like this:

    git archive -o ../subarchive.zip HEAD:subdir
    

    By the way, an easy way to play with the command and see what it will generate is if you use it in this form:

    git archive --format=tar HEAD:subdir | tar t
    git archive --format=tar HEAD subdir | tar t
    # ... and so on ...
    

    Once you see what you're looking for, you can change the format and use the -o flag to actually create the archive.

    0 讨论(0)
提交回复
热议问题