So I want to export all files starting from specific commit id till today (which may include subsequent commits), so I am doing this:
git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT $commitId | xargs tar -rf output.tar
However, it seems this outputs file only that were modified in specified commit id ($commitId).
What I am looking for though is that it should export all files starting from specified commit id till today (including any further commits that might have happened during the course of the time).
git diff -z --name-only --diff-filter ACMRT ${commitId}~ HEAD | xargs -0 tar -rf output.tar
git diff is sufficient; you don't need to use git diff-tree to find the list of changed filenames in a commit range.-z option in git diff and -0 in xargs makes sure to use NUL output field terminators, otherwise any paths/filenames with spaces will cause your command to break.${commitId}~ HEAD lists changes between the parent commit of ${commitId} (so the changes in that commit are included), and the most recent commit (HEAD).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With