Skip to content

Instantly share code, notes, and snippets.

@syuji-higa
Last active November 16, 2019 04:59
Show Gist options
  • Save syuji-higa/65b1dabea9c8a1ce2e5049d4fcf2ad59 to your computer and use it in GitHub Desktop.
Save syuji-higa/65b1dabea9c8a1ce2e5049d4fcf2ad59 to your computer and use it in GitHub Desktop.
batch - Git diff and archive
repos={repositorys}
target={target}
output={output}
name=$1
suffix=$2
from=$3
to=$4
repo=${repos}/${name}
zip=${name}-diff-${suffix}
git --git-dir=${repo}/.git --work-tree=${repo} archive --format=zip --prefix=${zip}- --output=${output}/${zip}.zip HEAD `git --git-dir=${repo}/.git --work-tree=${repo} diff --diff-filter=ACMR --name-only ${from}..${to} ${repo}/${target}`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment