Hi, thanks very much, this help me a lot,
but it works only if there are no delete files between the commit files.
this is my jenkins log
rm -rf target_dir
+ mkdir target_dir
+ git diff-tree --no-commit-id --name-only -r HEAD
+ cp -r --parents puro/error_log puro/tmp/test/tes2/testfile.php target_dir
cp: cannot stat `puro/error_log': No such file or directory
Build step 'Execute shell' marked build as failure
SSH: Current build result is [FAILURE], not going to run.
Finished: FAILURE
-----------
when I displayed the delete files, I have
jenkins@vm-dev01:~/workspace/pmc$ git diff-tree --no-commit-id --name-status --diff-filter=D -r HEAD
D puro/error_log
and to push only added or modified files, I can do
rm -rf target_dir
mkdir target_dir
cp -r --parents $(git diff-tree --no-commit-id --name-status --diff-filter=ACMRTUXB -r $GIT_COMMIT) target_dir
but for the deleted files, I don't know how to do.
do you have any solution to delete files in the remote directory ?