Git archive of repository with uncommitted changes

前端 未结 9 852
旧时难觅i
旧时难觅i 2021-02-01 18:31

How can I create an archive of the current repository including local uncommitted changes using git archive?

9条回答
  •  生来不讨喜
    2021-02-01 19:09

    a small bash script based on @fhucho's answer:

    #backup.sh
    #remove final "/"
    repo=${1%"/"} 
    #create $repo-backup.zip
    cd $repo
    git ls-files --others --exclude-standard --cached  | zip --names-stdin ../$repo-backup.zip
    cd ..
    ls -l $repo-backup.zip
    

    usage:

    . backup.sh myrepo
    

提交回复
热议问题