zoukankan      html  css  js  c++  java
  • git命令将代码导出为单个文件

    ming@xiaomingdeMacBook-Pro:~$ git archive 
    usage: git archive [<options>] <tree-ish> [<path>...]
       or: git archive --list
       or: git archive --remote <repo> [--exec <cmd>] [<options>] <tree-ish> [<path>...]
       or: git archive --remote <repo> [--exec <cmd>] --list
    
        --format <fmt>        archive format
        --prefix <prefix>     prepend prefix to each pathname in the archive
        -o, --output <file>   write the archive to this file
        --worktree-attributes
                              read .gitattributes in working directory
        -v, --verbose         report archived files on stderr
        -0                    store only
        -1                    compress faster
        -9                    compress better
    
        -l, --list            list supported archive formats
    
        --remote <repo>       retrieve the archive from remote repository <repo>
        --exec <command>      path to the remote git-upload-archive command
    

    示例:

    1、导出为zip格式压缩包

    git archive -v --format=zip 分支名 -o 压缩包文件名
    

    如:

    git archive -v --format=zip v0.1 -o v0.1.zip
    

    2、导出为tar格式文件

    git archive -v --format=tar 分支名 -o 文件名
    

    如:

    git archive -v --format=tar v0.1 -o v0.1.tar
    

    注:--format也可以不显式指明。git可以根据文件名的后缀自动判断,如果是.zip结尾,则是zip格式,否则输出为tar格式。

  • 相关阅读:
    hdu6148 Valley Numer
    NOI2007 生成树计数
    bzoj3336 Uva10572 Black and White
    hdu1693 eat the trees
    【模板】插头dp
    bzoj4712 洪水
    ZJOI2010 基站选址
    poj2376 Cleaning Shifts
    bzoj4367 [IOI2014]holiday假期
    bzoj4951 [Wf2017]Money for Nothing
  • 原文地址:https://www.cnblogs.com/xiaoming/p/14269408.html
Copyright © 2011-2022 走看看