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

后端 未结 30 2868
暖寄归人
暖寄归人 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:04

    i have the following utility function in my .bashrc file: it creates an archive of the current branch in a git repository.

    function garchive()
    {
      if [[ "x$1" == "x-h" || "x$1" == "x" ]]; then
        cat <
    create zip archive of the current branch into 
    EOF
      else
        local oname=$1
        set -x
        local bname=$(git branch | grep -F "*" | sed -e 's#^*##')
        git archive --format zip --output ${oname} ${bname}
        set +x
      fi
    }
    

提交回复
热议问题