Skip to content

Instantly share code, notes, and snippets.

@hgc81538
Last active April 3, 2023 08:42
Show Gist options
  • Save hgc81538/80ee192be3c1534aad38714eb981c9a7 to your computer and use it in GitHub Desktop.
Save hgc81538/80ee192be3c1534aad38714eb981c9a7 to your computer and use it in GitHub Desktop.
# 1 commit
cp --parents `git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $commit_id` ../output
# between commits
cp --parents `git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $commit_id_start $commit_id_end` ../output
# reference
https://stackoverflow.com/questions/4541300/export-only-modified-and-added-files-with-folder-structure-in-git
https://stackoverflow.com/questions/29300910/how-to-send-output-of-ls-l-to-cp-command-using-pipes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment