Do a “git export” (like “svn export”)?

后端 未结 30 3437
暖寄归人
暖寄归人 2020-11-21 22:33

I\'ve been wondering whether there is a good \"git export\" solution that creates a copy of a tree without the .git repository directory. There are at least thr

30条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-21 23:02

    If you want something that works with submodules this might be worth a go.

    Note:

    • MASTER_DIR = a checkout with your submodules checked out also
    • DEST_DIR = where this export will end up
    • If you have rsync, I think you'd be able to do the same thing with even less ball ache.

    Assumptions:

    • You need to run this from the parent directory of MASTER_DIR ( i.e from MASTER_DIR cd .. )
    • DEST_DIR is assumed to have been created. This is pretty easy to modify to include the creation of a DEST_DIR if you wanted to

    cd MASTER_DIR && tar -zcvf ../DEST_DIR/export.tar.gz --exclude='.git*' . && cd ../DEST_DIR/ && tar xvfz export.tar.gz && rm export.tar.gz

提交回复
热议问题