Studyon Minte9.com
Git




Export only modified files




$ git log
// Show GIT log commit 64f7f3fcc8cdf86103a6596af2818bf4ca25620f .... commit 213197f697a3a266860a5959483cb239fc81bad8 ...
$ git rev-parse HEAD
// Display HEAD commit ID 64f7f3fcc8cdf86103a6596af2818bf4ca25620f
$ git diff-tree -r $commit_id
// Take a diff of the given commit to its parent(s). $commit_id = 64f7f3fcc8cdf86103a6596af2818bf4ca25620f 64f7f3fcc8cdf86103a6596af2818bf4ca25620f ... Application/layouts/partials/top.phtml
$ git diff-tree -r $commit_id --no-commit-id --name-only
// Output only the names of the affected files instead of a full diff. Application/layouts/partials/top.phtml
$ git diff-tree -r $commit_id --no-commit-id --name-only --diff-filter=ACMRT
// Only show files added, copied, modified, renamed, changed - (without deleted) Application/layouts/partials/top.phtml
$ git diff-tree -r $commit_id --no-commit-id --name-only --diff-filter=ACMRT | xargs tar -rf my.tar
// Exports the files into a tar archive
$ git diff --stat @{2015-01-15}..@{2015-01-16} | xargs tar -cf 20150116.tar
// Export the files between two days
$ git diff --stat @{2015-01-01} --diff-filter=ACRMRT --name-only | xargs tar -cf 201501.tar
// Export the files starting with a day // diff-filter=ACRMRT (without deleted) // name-only (important, otherwise it will not work with long directory trees) Alias (.gitconfig)
[alias] exportmdf = "!f() { git diff --stat @{$1} --diff-filter=ACRMRT --name-only | xargs tar -cf $2; }; f"

git exportmdf 2016-11-01 11.tar


http://stackoverflow.com/questions/4541300/export-only-modified-and-added-files-with-folder-structure-in-git
http://stackoverflow.com/questions/1967967/git-command-to-display-head-commit-id
http://stackoverflow.com/questions/1161609/how-can-i-get-the-di